Function IOThreadStorage

Synopsis

#include <lib/inc/drogon/IOThreadStorage.h>

template <typename... Args>
IOThreadStorage(Args &&...args)

Description

No description yet.

Source

Lines 66-82 in lib/inc/drogon/IOThreadStorage.h.

template <typename... Args>
IOThreadStorage(Args &&...args)
{
    static_assert(std::is_constructible<C, Args &&...>::value,
                  "Unable to construct storage with given signature");
    size_t numThreads = app().getThreadNum();
    assert(numThreads > 0 &&
           numThreads != (std::numeric_limits<size_t>::max)());
    // set the size to numThreads+1 to enable access to this in the main
    // thread.
    storage_.reserve(numThreads + 1);
    for (size_t i = 0; i <= numThreads; ++i)
    {
        storage_.emplace_back(std::forward<Args>(args)...);
    }
}





Add Discussion as Guest

Log in