From 1ededbc0cfdbe42e41992b04b9ab18d6d7525100 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Mon, 12 Dec 2005 23:39:50 +0000 Subject: [PATCH] fix the use of the old __THREAD__ macro git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7976 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/director_h.swg | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Lib/python/director_h.swg b/Lib/python/director_h.swg index 362c59bd7..984c147d4 100644 --- a/Lib/python/director_h.swg +++ b/Lib/python/director_h.swg @@ -305,6 +305,13 @@ namespace Swig { }; +#if defined(SWIG_PYTHON_THREADS) +/* __THREAD__ is the old macro to activate some thread support */ +# if !defined(__THREAD__) +# define __THREAD__ +# endif +#endif + /* simple thread abstraction for pthreads on win32 */ #ifdef __THREAD__ # define __PTHREAD__ @@ -313,19 +320,13 @@ namespace Swig { # define pthread_mutex_unlock LeaveCriticalSection # define pthread_mutex_t CRITICAL_SECTION # define SWIG_MUTEX_INIT(var) var +# else +# include +# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER # endif -#else -# include -# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER #endif #ifdef __PTHREAD__ -# define SWIG_GUARD(mutex) Guard _guard(mutex) -#else -# define SWIG_GUARD(mutex) -#endif - - struct Guard { pthread_mutex_t *_mutex; @@ -340,6 +341,10 @@ namespace Swig { pthread_mutex_unlock(_mutex); } }; +# define SWIG_GUARD(mutex) Guard _guard(mutex) +#else +# define SWIG_GUARD(mutex) +#endif /* director base class */ class Director {