LogCabin
Namespaces | Functions | Variables
Core/ThreadId.cc File Reference
#include <mutex>
#include <unordered_map>
#include "Core/ThreadId.h"
#include "Core/StringUtil.h"

Go to the source code of this file.

Namespaces

namespace  LogCabin
namespace  LogCabin::Core
namespace  LogCabin::Core::ThreadId
 

Provides a convenient way to get identifiers for threads.


namespace  LogCabin::Core::ThreadId::Internal

Functions

void LogCabin::Core::ThreadId::Internal::assign ()
 Pick a unique value to use as the thread identifier for the current thread.
uint64_t LogCabin::Core::ThreadId::getId ()
 Return a unique identifier associated with this thread.
void LogCabin::Core::ThreadId::setName (const std::string &name)
 Set the friendly name for the current thread.
std::string LogCabin::Core::ThreadId::getName ()
 Get the friendly name for the current thread.

Variables

__thread uint64_t LogCabin::Core::ThreadId::Internal::id
 Thread-specific data holds the identifier for each thread.
std::mutex LogCabin::Core::ThreadId::Internal::mutex
 Used to serialize access to nextId.
uint64_t LogCabin::Core::ThreadId::Internal::nextId
 The next thread identifier that has not already been used.
std::unordered_map< uint64_t,
std::string > 
LogCabin::Core::ThreadId::Internal::threadNames
 A map from thread ID to thread name.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines