--- parser3/src/main/pa_threads.C 2020/12/11 15:44:14 1.5 +++ parser3/src/main/pa_threads.C 2023/09/26 20:49:10 1.9 @@ -1,38 +1,36 @@ /** @file Parser: simple Mutex realization class. - Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #include "pa_threads.h" -volatile const char * IDENT_PA_THREADS_C="$Id: pa_threads.C,v 1.5 2020/12/11 15:44:14 moko Exp $" IDENT_PA_THREADS_H; +volatile const char * IDENT_PA_THREADS_C="$Id: pa_threads.C,v 1.9 2023/09/26 20:49:10 moko Exp $" IDENT_PA_THREADS_H; Mutex global_mutex; -#ifdef WIN32 - -#include +#ifdef _MSC_VER uint pa_get_thread_id() { return GetCurrentThreadId(); } Mutex::Mutex() : - handle(reinterpret_cast(CreateMutex(NULL, FALSE, 0))) { + handle(CreateMutex(NULL, FALSE, 0)) { } Mutex::~Mutex() { - CloseHandle(reinterpret_cast(handle)); + CloseHandle(handle); } void Mutex::acquire() { - WaitForSingleObject(reinterpret_cast(handle), INFINITE); + WaitForSingleObject(handle, INFINITE); } void Mutex::release() { - ReleaseMutex(reinterpret_cast(handle)); + ReleaseMutex(handle); } #else @@ -46,7 +44,7 @@ uint pa_get_thread_id() { #ifdef HAVE_GETTID return syscall(__NR_gettid); #else - return 1; + return getpid(); #endif }