22#include <boost/core/noncopyable.hpp>
23#include <boost/thread/tss.hpp>
286template<
typename Thread_local_state_t>
288 private boost::noncopyable
421 boost::thread_specific_ptr<Thread_local_state>
m_tsp;
429template<
typename Thread_local_state_t>
436template<
typename Thread_local_state_t>
439template<
typename Thread_local_state_t>
442template<
typename Thread_local_state_t>
469 const auto cache_result = m_cache.reset_release(new_value);
470 if (cache_result == Reset_result::S_INOPERATIVE)
475 m_tsp.reset(new_value);
481 if (cache_result == Reset_result::S_DUPE)
491 m_tsp.reset(new_value);
497 m_cache.reset_set(new_value);
501template<
typename Thread_local_state_t>
504 const auto cache_result_or_inoperative = m_cache.get();
505 return cache_result_or_inoperative
512template<
typename Thread_local_state_t>
518template<
typename Thread_local_state_t>
522 assert(value &&
"Used against contract.");
526template<
typename Thread_local_state_t>
531 return m_tsp.release();
Internal-use helper for Thread_local_ptr which encapsulates that guy's thread_locally-accessed TLS pa...
Reset_result
Encodes result of reset_release(), indicating what the calling Thread_local_ptr::reset() should do ne...
boost::thread_specific_ptr replacement (augmentation) whose fast-path .get() touches only thread_loca...
Thread_local_state * operator->() const
It's get().
Thread_local_state * release()
Equivalent to boost::thread_specific_ptr, potentially forgets – but does not clean as via cleanup_fun...
void(*)(Thread_local_state *) cleanup_func_t
Type for cleanup_func_t() to ctor: takes Thread_local_state*; must not throw.
Thread_local_state_t Thread_local_state
Pointer-to-this-type is stored thread-locally; and cleanup_func_t takes an argument of pointer-to-thi...
Thread_local_ptr()
Equivalent to Thread_local_ptr(f), where f(t) performs delete t;.
~Thread_local_ptr()
Destructor equivalent to that of boost::thread_specific_ptr.
boost::thread_specific_ptr< Thread_local_state > m_tsp
The canonical boost::thread_specific_ptr.
void reset(Thread_local_state *new_value=nullptr)
Equivalent to boost::thread_specific_ptr, potentially forgets/cleans current get(); potentially recor...
Thread_local_state * get() const
Equivalent to boost::thread_specific_ptr, returns the value last passed in this thread to reset(); or...
Thread_local_state & operator*() const
It's *(get()).
Thread_local_ptr_cache m_cache
The thread_local-oriented duplication of information in m_tsp. See our class doc header.
Thread_local_ptr(cleanup_func_t cleanup_func)
Equivalent to boost::thread_specific_ptr: memorizes the given function pointer.
Flow module containing miscellaneous general-use facilities that don't fit into any other Flow module...
The actual user Thread_local_state stored per thread as lazily-created in this_thread_state(); plus a...