Grok 20.3.2
TFSingleton Class Reference

Manages TFSingleton instance. More...

#include <TFSingleton.h>

Static Public Member Functions

static void create (size_t numThreads)
 Creates singleton instance.
static tf::Executor & get (void)
 Gets current instance of the Singleton (creates with full hardware concurrency if null).
static size_t num_threads ()
 Gets total number of threads (including driver thread).
static void destroy ()
 Destroys TFSingleton.
static uint32_t workerId (void)
 Gets worker id for current worker.

Private Member Functions

 TFSingleton (const TFSingleton &)=delete
TFSingletonoperator= (const TFSingleton &)=delete
 TFSingleton ()=default
 Constructs an TFSingleton.

Static Private Attributes

static std::unique_ptr< tf::Executor > instance_ = nullptr
 Taskflow Executor instance.
static std::mutex mutex_
 std::mutex to control access to instance_
static size_t numThreads_
 total number of threads

Detailed Description

Manages TFSingleton instance.

Constructor & Destructor Documentation

◆ TFSingleton() [1/2]

TFSingleton::TFSingleton ( const TFSingleton & )
privatedelete

References TFSingleton().

Referenced by operator=(), and TFSingleton().

◆ TFSingleton() [2/2]

TFSingleton::TFSingleton ( )
privatedefault

Constructs an TFSingleton.

Member Function Documentation

◆ create()

void TFSingleton::create ( size_t numThreads)
inlinestatic

Creates singleton instance.

Parameters
numThreadstotal number of threads including main thread i.e. number of taskflow worker threads

References instance_, mutex_, and numThreads_.

Referenced by grk_initialize().

◆ destroy()

void TFSingleton::destroy ( )
inlinestatic

Destroys TFSingleton.

References instance_, and mutex_.

Referenced by grk_deinitialize(), and GrkCleanup::~GrkCleanup().

◆ get()

◆ num_threads()

◆ operator=()

TFSingleton & TFSingleton::operator= ( const TFSingleton & )
privatedelete

References TFSingleton().

◆ workerId()

uint32_t TFSingleton::workerId ( void )
inlinestatic

Gets worker id for current worker.

Returns
TaskFlow thread id if more than one thread is configured AND the method is called from inside a TaskFlow task. Otherwise returns zero.

References get().

Referenced by grk_worker_id(), grk::TileProcessor::parseTilePart(), grk::TileProcessor::readPLT(), and grk::TileProcessor::setProcessors().

Member Data Documentation

◆ instance_

std::unique_ptr< tf::Executor > TFSingleton::instance_ = nullptr
staticprivate

Taskflow Executor instance.

Referenced by create(), destroy(), and get().

◆ mutex_

std::mutex TFSingleton::mutex_
staticprivate

std::mutex to control access to instance_

Referenced by create(), destroy(), get(), and num_threads().

◆ numThreads_

size_t TFSingleton::numThreads_
staticprivate

total number of threads

Referenced by create(), get(), and num_threads().


The documentation for this class was generated from the following files: