| 248 | typename T |
| 249 | > |
| 250 | inline void unregister_thread_end_handler ( |
| 251 | T& obj, |
| 252 | void (T::*handler)() |
| 253 | ) |
| 254 | { |
| 255 | // Check if the thread pool has been destroyed and if it has then don't do anything. |
| 256 | // This bool here is always true except when the program has started to terminate and |
| 257 | // the thread pool object has been destroyed. This if is here to catch other global |
| 258 | // objects that have destructors that try to call unregister_thread_end_handler(). |
| 259 | // Without this check we get into trouble if the thread pool is destroyed before these |
| 260 | // objects. |
| 261 | if (threads_kernel_shared::thread_pool_has_been_destroyed == false) |
| 262 | threads_kernel_shared::thread_pool().unregister_thread_end_handler(obj,handler); |
| 263 | } |
| 264 | |
| 265 | // ---------------------------------------------------------------------------------------- |
| 266 | |