SimpleThreadLocalManager - SeqAn API Documentation

# Class SimpleThreadLocalManager
Internal policy used to manage thread specific storage.

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

## Member Function Overview

- `auto local(map, init);`
  Implements the specific `local` policy.

## 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.

## See Also

- CountingThreadLocalManager

## 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.

#### Dox Sources

    /*!
     * @class SimpleThreadLocalManager
     *
     * @headerfile <seqan/parallel.h>
     *
     * @brief Internal policy used to manage thread specific storage.
     *
     * @signature struct SimpleThreadLocalManager;
     *
     * 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.
     *
     * @see CountingThreadLocalManager
     *
     * @fn SimpleThreadLocalManager::local
     *
     * @headerfile <seqan/parallel.h>
     *
     * @brief Implements the specific <tt>local</tt> policy.
     *
     * @signature auto local(map, init);
     *
     * @param map The buffer provided by the @link EnumerableThreadLocal @endlink
     *            instance to the hold the thread local storage. Must satisfy the
     *            <tt>std::map</tt> interface.
     * @param init The value used to initialize created storage.
     *
     * @return auto A tuple containing a lvalue reference to the associated storage
     *              and a boolean indicating first time access of the given thread-
     *              id.
     *
     * @datarace thread-safe.
     */