diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 87979c4..5fdc799 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -150,17 +150,16 @@ static void destroy_current_thread_data(void *p) static void create_current_thread_data_key() { pthread_key_create(¤t_thread_data_key, destroy_current_thread_data); - static class destroy_current_thread_data_key - { - public: - ~destroy_current_thread_data_key() - { - pthread_key_delete(current_thread_data_key); - } - } d; - Q_UNUSED(d); } +static void destroy_current_thread_data_key() +{ + pthread_once(¤t_thread_data_once, create_current_thread_data_key); + pthread_key_delete(current_thread_data_key); +} +Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key) + + // Utility functions for getting, setting and clearing thread specific data. // In Symbian, TLS access is significantly faster than pthread_getspecific. // However Symbian does not have the thread destruction cleanup functionality |