--- parser3/src/include/pa_threads.h 2001/03/19 15:29:38 1.7 +++ parser3/src/include/pa_threads.h 2001/04/03 14:39:02 1.12 @@ -1,17 +1,17 @@ /** @file - Parser + Parser: mutex & helpers decls. + Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) + Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_threads.h,v 1.7 2001/03/19 15:29:38 paf Exp $ + $Id: pa_threads.h,v 1.12 2001/04/03 14:39:02 paf Exp $ */ #ifndef PA_THREADS_H #define PA_THREADS_H -#ifdef HAVE_CONFIG_H -# include "pa_config.h" -#endif +#include "pa_config_includes.h" #include "pa_types.h" @@ -30,7 +30,7 @@ public: extern Mutex global_mutex; -/** @brief +/** Helper to ensure paired Mutex::acquire() and Mutex::release(). Use it with SYNCHRONIZED macro @@ -48,24 +48,29 @@ public: } }; -/** @brief - put it to first line of a function to ensure thread safety - +/** + put it to first line of a function to ensure thread safety. @verbatim - void someclass::somefunc(...) { SYNCHRONIZED(thread_safe); - ... - } + void someclass::somefunc(...) { SYNCHRONIZED(thread_safe); + ... + } @endverbatim - considering \a thread_safe to be the object field to flag + considering @a thread_safe to be the object field to flag whether safety is really needed in this particular object instance */ #define SYNCHRONIZED(athread_safe) AutoSYNCHRONIZED autoSYNCHRONIZED(athread_safe) +#define SYNCH_LOCK global_mutex.acqire() +#define SYNCH_UNLOCK global_mutex.release() + #else // not MULTITHREAD-ed #define SYNCHRONIZED(athread_safe) /* do nothing */ +#define SYNCH_LOCK +#define SYNCH_UNLOCK + #endif