--- parser3/src/include/pa_threads.h 2003/01/21 15:51:12 1.26 +++ parser3/src/include/pa_threads.h 2026/04/25 13:38:46 1.40 @@ -1,31 +1,37 @@ /** @file Parser: mutex & helpers decls. - Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef PA_THREADS_H #define PA_THREADS_H -static const char* IDENT_THREADS_H="$Date: 2003/01/21 15:51:12 $"; +#define IDENT_PA_THREADS_H "$Id: pa_threads.h,v 1.40 2026/04/25 13:38:46 moko Exp $" #include "pa_config_includes.h" #include "pa_types.h" -/// thread ID type -typedef unsigned int pa_thread_t; +#ifdef _MSC_VER +#include +#endif /// get caller thread ID -pa_thread_t pa_get_thread_id(); +uint pa_get_thread_id(); class AutoSYNCHRONIZED; /// simple semaphore object class Mutex { friend class AutoSYNCHRONIZED; -private: - uint handle; + +#ifdef _MSC_VER +HANDLE handle; +#else +pthread_mutex_t handle; +#endif + public: Mutex(); ~Mutex(); @@ -34,14 +40,13 @@ private: // for AutoSYNCHRONIZED void release(); }; -extern const bool parser_multithreaded; extern Mutex global_mutex; /** Helper to ensure paired Mutex::acquire() and Mutex::release(). - Use it with SYNCHRONIZED macro */ + class AutoSYNCHRONIZED { public: AutoSYNCHRONIZED() { global_mutex.acquire(); }