diff -ur old/once.cpp new/once.cpp
old
|
new
|
|
8 | 8 | #include <boost/assert.hpp> |
9 | 9 | #include <pthread.h> |
10 | 10 | #include <stdlib.h> |
| 11 | #include <string.h> |
11 | 12 | |
12 | 13 | namespace boost |
13 | 14 | { |
… |
… |
|
21 | 22 | { |
22 | 23 | pthread_key_t epoch_tss_key; |
23 | 24 | pthread_once_t epoch_tss_key_flag=PTHREAD_ONCE_INIT; |
| 25 | const pthread_once_t pthread_once_init_value=PTHREAD_ONCE_INIT; |
24 | 26 | |
25 | 27 | extern "C" void delete_epoch_tss_data(void* data) |
26 | 28 | { |
… |
… |
|
31 | 33 | { |
32 | 34 | BOOST_VERIFY(!pthread_key_create(&epoch_tss_key,delete_epoch_tss_data)); |
33 | 35 | } |
34 | | |
| 36 | |
| 37 | void __attribute__((destructor)) delete_epoch_tss_key_on_dlclose() |
| 38 | { |
| 39 | if(memcmp(&epoch_tss_key_flag, &pthread_once_init_value, sizeof(pthread_once_t))) |
| 40 | pthread_key_delete(epoch_tss_key); |
| 41 | } |
35 | 42 | } |
36 | 43 | |
37 | 44 | boost::uintmax_t& get_once_per_thread_epoch() |
diff -ur old/thread.cpp new/thread.cpp
old
|
new
|
|
101 | 101 | { |
102 | 102 | BOOST_VERIFY(!pthread_key_create(¤t_thread_tls_key,&tls_destructor)); |
103 | 103 | } |
| 104 | |
| 105 | void __attribute__((destructor)) delete_current_thread_tls_key_on_dlclose() |
| 106 | { |
| 107 | if (current_thread_tls_init_flag.epoch!=BOOST_ONCE_INITIAL_FLAG_VALUE) |
| 108 | pthread_key_delete(current_thread_tls_key); |
| 109 | } |
104 | 110 | } |
105 | 111 | |
106 | 112 | boost::detail::thread_data_base* get_current_thread_data() |