TSDuck v3.40-4163
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
Multi-threading

Multi-threading and synchronization features. More...

Collaboration diagram for Multi-threading:

Classes

class  ts::MessagePriorityQueue< MSG, COMPARE >
 Template message queue for inter-thread communication with priority. More...
 
class  ts::MessageQueue< MSG >
 Template message queue for inter-thread communication. More...
 
class  ts::null_mutex
 A null_mutex class which can be used to replace std::mutex or std::recursive_mutex. More...
 
class  ts::Thread
 Base class for threads. More...
 
class  ts::ThreadAttributes
 Set of attributes for a thread object (ts::Thread). More...
 
struct  ts::ThreadSafetyMutex< THS >
 Define the appropriate mutex class for a given level of thread-safety. More...
 
class  ts::WatchDog
 General-purpose timeout watchdog. More...
 
class  ts::WatchDogHandlerInterface
 Expiration handler interface for general-purpose timeout watchdog. More...
 

Macros

#define TS_STATIC_MUTEX(mutex_class, function_name)
 Define a static mutex inside a translation unit.
 

Enumerations

enum class  ts::ThreadSafety {
  ts::ThreadSafety::Full ,
  ts::ThreadSafety::None
}
 Thread safety property of a class. More...
 

Detailed Description

Multi-threading and synchronization features.

Macro Definition Documentation

◆ TS_STATIC_MUTEX

#define TS_STATIC_MUTEX (   mutex_class,
  function_name 
)

Define a static mutex inside a translation unit.

Inside a source file, it is sometimes necessary to define a static mutex which controls access to resources in the module. When resources in the source file are invoked in the initializaiton phase, it is not possible to rely on the fact that the mutex object is already initialized. This macro solves this problem using an encapsulation of the mutex object inside a private function of the module.

Parameters
mutex_classFully qualified name of the mutex class.
function_nameName of the instance function which returns the mutex object.

Enumeration Type Documentation

◆ ThreadSafety

enum class ts::ThreadSafety
strong

Thread safety property of a class.

Enumerator
Full 

Thread safe, can be used from multiple threads.

None 

No thread safety, use in one single thread or use explicit synchronization.