diff options
Diffstat (limited to 'include/asterisk/threadstorage.h')
-rw-r--r-- | include/asterisk/threadstorage.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/asterisk/threadstorage.h b/include/asterisk/threadstorage.h index 1fd0f04cf..91e88dc7f 100644 --- a/include/asterisk/threadstorage.h +++ b/include/asterisk/threadstorage.h @@ -62,6 +62,12 @@ struct ast_threadstorage { int (*custom_init)(void *); /*!< Custom initialization function specific to the object */ }; +#ifdef SOLARIS +#define THREADSTORAGE_ONCE_INIT {PTHREAD_ONCE_INIT} +#else +#define THREADSTORAGE_ONCE_INIT PTHREAD_ONCE_INIT +#endif + #if defined(DEBUG_THREADLOCALS) void __ast_threadstorage_object_add(void *key, size_t len, const char *file, const char *function, unsigned int line); void __ast_threadstorage_object_remove(void *key); @@ -103,7 +109,7 @@ void __ast_threadstorage_object_replace(void *key_old, void *key_new, size_t len #define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup) \ static void __init_##name(void); \ static struct ast_threadstorage name = { \ - .once = PTHREAD_ONCE_INIT, \ + .once = THREADSTORAGE_ONCE_INIT, \ .key_init = __init_##name, \ .custom_init = c_init, \ }; \ @@ -115,7 +121,7 @@ static void __init_##name(void) \ #define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup) \ static void __init_##name(void); \ static struct ast_threadstorage name = { \ - .once = PTHREAD_ONCE_INIT, \ + .once = THREADSTORAGE_ONCE_INIT, \ .key_init = __init_##name, \ .custom_init = c_init, \ }; \ |