--- parser3/src/include/pa_threads.h 2001/05/17 10:22:24 1.14 +++ parser3/src/include/pa_threads.h 2002/02/08 08:30:14 1.23 @@ -1,11 +1,10 @@ /** @file Parser: mutex & helpers decls. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexandr Petrosian (http://paf.design.ru) - Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: pa_threads.h,v 1.14 2001/05/17 10:22:24 parser Exp $ + $Id: pa_threads.h,v 1.23 2002/02/08 08:30:14 paf Exp $ */ #ifndef PA_THREADS_H @@ -14,14 +13,17 @@ #include "pa_config_includes.h" #include "pa_types.h" +/// thread ID type +typedef unsigned int pa_thread_t; -#ifdef MULTITHREAD +/// get caller thread ID +pa_thread_t pa_get_thread_id(); class AutoSYNCHRONIZED; /// simple semaphore object class Mutex { - friend AutoSYNCHRONIZED; + friend class AutoSYNCHRONIZED; private: uint handle; public: @@ -32,6 +34,7 @@ private: // for AutoSYNCHRONIZED void release(); }; +extern const bool parser_multithreaded; extern Mutex global_mutex; /** @@ -54,12 +57,8 @@ public: @endverbatim WARNING: don't use THROW or PTHROW with such thread safety mechanizm - - longjump would leave global_mutex acquired, which is wrong! + longjmp would leave global_mutex acquired, which is wrong! */ -# define SYNCHRONIZED AutoSYNCHRONIZED autoSYNCHRONIZED() -#else // not MULTITHREAD-ed -# define SYNCHRONIZED /* do nothing */ -#endif - +#define SYNCHRONIZED AutoSYNCHRONIZED autoSYNCHRONIZED #endif