diff options
author | Aman Gupta <aman@tmm1.net> | 2009-07-19 01:12:34 -0700 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2009-07-19 01:12:34 -0700 |
commit | 43e7e02f6bcb2f6e2a9593a4d562e9c93bddbf0d (patch) | |
tree | 15cc6da1ba8a53c2966853188a84c482d0c968d2 | |
parent | 5e05e65283b4ab271754f4577f490031971a836d (diff) | |
download | ffi-43e7e02f6bcb2f6e2a9593a4d562e9c93bddbf0d.tar.gz |
Fix LastError compile errors when HAVE_NATIVETHREAD
-rw-r--r-- | ext/ffi_c/Invoker.c | 10 | ||||
-rw-r--r-- | ext/ffi_c/LastError.c | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/ext/ffi_c/Invoker.c b/ext/ffi_c/Invoker.c index 7af560e..4fc7404 100644 --- a/ext/ffi_c/Invoker.c +++ b/ext/ffi_c/Invoker.c @@ -26,6 +26,9 @@ #if defined(__i386__) && !defined(_WIN32) && !defined(__WIN32__) # define USE_RAW #endif +#if defined(HAVE_NATIVETHREAD) && !defined(_WIN32) && !defined(__WIN32__) +# define USE_PTHREAD_LOCAL +#endif #define MAX_FIXED_ARITY (3) #ifndef roundup @@ -946,4 +949,11 @@ rbffi_Invoker_Init(VALUE moduleFFI) PageSize = sysconf(_SC_PAGESIZE); #endif /* _WIN32 */ +#if defined(USE_PTHREAD_LOCAL) + for (i = 0; i < 4; ++i) { + pthread_mutex_init(&methodHandlePool[i].mutex, NULL); + } + pthread_mutex_init(&defaultMethodHandlePool.mutex, NULL); +#endif /* USE_PTHREAD_LOCAL */ + } diff --git a/ext/ffi_c/LastError.c b/ext/ffi_c/LastError.c index c3834bd..d04a8c9 100644 --- a/ext/ffi_c/LastError.c +++ b/ext/ffi_c/LastError.c @@ -130,10 +130,6 @@ rbffi_LastError_Init(VALUE moduleFFI) #if defined(USE_PTHREAD_LOCAL) pthread_key_create(&threadDataKey, thread_data_free); - for (i = 0; i < 4; ++i) { - pthread_mutex_init(&methodHandlePool[i].mutex, NULL); - } - pthread_mutex_init(&defaultMethodHandlePool.mutex, NULL); #else id_thread_data = rb_intern("ffi_thread_local_data"); #endif /* USE_PTHREAD_LOCAL */ |