Class CountingThreadLocalManager
Internal policy used to manage thread specific storage for a limited number of threads.

Defined in <seqan/parallel.h>
Signature struct SimpleThreadLocalManager;

Member Function Overview

Detailed Description

Uses a shared mutex to synchronize concurrent access to the storage buffer (multiple read, single write). This policy checks if the thread-id was already registered and if not creates a new storage instance for the given thread-id. In addition maintains an atomic counter to only check for existing values as long as the counter is not 0. This can be used if the number of threads registering at the EnumerableThreadLocal instance, is known beforehand. In this case, as soon as all threads have been registered and obtained their local storage, no further synchronization is necessary.

See Also

Member Functions Detail

auto local(map, init);

Implements the specific local policy.

Parameters

map The buffer provided by the EnumerableThreadLocal instance to the hold the thread local storage. Must satisfy the std::map interface.
init The value used to initialize created storage.

Returns

auto A tuple containing a lvalue reference to the associated storage and a boolean indicating first time access of the given thread-id.

Data Races

thread-safe.