xtd 0.2.0
Loading...
Searching...
No Matches

◆ thread_local_object() [4/4]

template<typename value_t >
xtd::threading::thread_local_object< value_t >::thread_local_object ( const func< value_t > &  value_factory,
bool  track_all_values 
)
inline

Initializes the xtd::threading::thread_local_object instance with the specified value_factory function and a flag that indicates whether all values are accessible from any thread.

Parameters
value_factoryThe xtd::func invoked to produce a lazily-initialized value when an attempt is made to retrieve Value without it having been previously initialized.
track_all_valuestrue to track all values set on the instance and expose them through the xtd::threading::thread_local_object::values property; false otherwise. When set to true, a value stored from a given thread will be available through xtd::threading::thread_local_object::values even after that thread has exited.
Remarks
If track_all_values is false, only the value of this instance for the current thread is accessible. Attempting to use the xtd::threading::thread_local_object::values property to retrieve all values throws an xtd::invalid_operation_exception exception.