From 61647d677630d64adc2d4485bd60f7613abbcfb1 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 16 Sep 2008 12:49:50 +0000 Subject: [PATCH] 2008-09-16 14:49 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbthread.h + added DMC to list of compilers which can use __declspec( thread ) + automatically use TLS for Linux and GLIBC >= 2.6 on x86* machines * harbour/include/hbthread.h * harbour/source/vm/estack.c * harbour/source/vm/thread.c ! clean up typos in OS2 builds --- harbour/ChangeLog | 10 ++++++++++ harbour/include/hbthread.h | 12 +++++++++--- harbour/source/vm/estack.c | 2 ++ harbour/source/vm/thread.c | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f99f729518..f436977701 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-09-16 14:49 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbthread.h + + added DMC to list of compilers which can use __declspec( thread ) + + automatically use TLS for Linux and GLIBC >= 2.6 on x86* machines + + * harbour/include/hbthread.h + * harbour/source/vm/estack.c + * harbour/source/vm/thread.c + ! clean up typos in OS2 builds + 2008-09-16 13:01 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/compiler/hbgenerr.c * Most ':' chars removed from Harbour compiler error messages. diff --git a/harbour/include/hbthread.h b/harbour/include/hbthread.h index 9950a52a02..fb0a45fd4b 100644 --- a/harbour/include/hbthread.h +++ b/harbour/include/hbthread.h @@ -188,7 +188,7 @@ HB_EXTERN_BEGIN # define HB_CRITICAL_INITVAL ( ( HMTX ) 0 ) # define HB_COND_INITVAL ( ( HEV ) 0 ) -# define HB_THREAD_SELF() _gettid() +# define HB_THREAD_SELF() ( ( TID ) _gettid() ) # define HB_CRITICAL_INIT(v) DosCreateMutexSem( NULL, &(v), 0L, FALSE ) # define HB_CRITICAL_DESTROY(v) DosCloseMutexSem( v ) @@ -303,13 +303,19 @@ extern void hb_threadMutexUnlockAll( void ); */ # if defined( __BORLANDC__ ) # define HB_USE_TLS +# elif defined( __GNUC__ ) && __GNUC__ >= 3 && \ + defined( __GLIBC__ ) && defined( __GLIBC_MINOR__ ) && \ + ( __GLIBC__ > 2 || ( __GLIBC__ == 2 && __GLIBC_MINOR__ >= 6 ) ) && \ + defined( HB_OS_LINUX ) && \ + ( defined( __i386__ ) || defined( __x86_64__ ) ) +# define HB_USE_TLS # endif #endif #ifdef HB_USE_TLS # if ( defined( __GNUC__ ) && __GNUC__ >= 3 ) || defined( __BORLANDC__ ) # define HB_TLS_ATTR __thread -# elif defined( _MSC_VER ) || defined( __WATCOMC__ ) +# elif defined( _MSC_VER ) || defined( __WATCOMC__ ) || defined( __DMC__ ) # define HB_TLS_ATTR __declspec( thread ) # else # undef HB_USE_TLS @@ -331,7 +337,7 @@ extern void hb_threadMutexUnlockAll( void ); # elif defined( HB_OS_OS2 ) # define HB_TLS_KEY PULONG # define hb_tls_init(k) DosAllocThreadLocalMemory( 1, &k ) -# define hb_tls_set(k,v) do { *k = ( ULONG ) (v) } while( 0 ) +# define hb_tls_set(k,v) do { *k = ( ULONG ) (v); } while( 0 ) # define hb_tls_get(k) ( *k ) # endif #endif diff --git a/harbour/source/vm/estack.c b/harbour/source/vm/estack.c index 5050a84e1a..4598991144 100644 --- a/harbour/source/vm/estack.c +++ b/harbour/source/vm/estack.c @@ -50,6 +50,8 @@ * */ +#define INCL_DOSPROCESS + #include "hbvmopt.h" #include "hbapi.h" #include "hbapicls.h" diff --git a/harbour/source/vm/thread.c b/harbour/source/vm/thread.c index d178dd0757..7dc1d05d3e 100644 --- a/harbour/source/vm/thread.c +++ b/harbour/source/vm/thread.c @@ -53,6 +53,7 @@ #define HB_OS_WIN_32_USED #define INCL_DOSSEMAPHORES +#define INCL_DOSPROCESS #define _HB_THREAD_INTERNAL_