+ unsigned *thread_id_ptr = thread_id_specific_ptr.get();
+ unsigned thread_id;
+ if (thread_id_ptr) {
+ thread_id = *thread_id_ptr;
+ } else {
+ thread_id = next_thread_id++;
+ thread_id_ptr = new unsigned;
+ *thread_id_ptr = thread_id;
+ thread_id_specific_ptr.reset(thread_id_ptr);
+ }