\r\n

51Degrees Device Detection C/C++  4.4

A device detection library that is used natively or by 51Degrees products

FiftyoneDegrees::Examples::Hash::ExampleBase::SharedState Class Reference

Detailed Description

State containing the states for all threads running in a multi-threaded example .

Examples
Hash/ReloadFromFile.cpp, and Hash/ReloadFromMemory.cpp.

Collaboration diagram for FiftyoneDegrees::Examples::Hash::ExampleBase::SharedState:

[legend]

Public Member Functions

 SharedState (EngineHash *engine, string userAgentFilePath)
Construct a new shared state instance. More...
void  startThreads ()
Starts threads that run the processUserAgentsMulti method.
void  joinThreads ()
Joins the threads and frees the memory occupied by the threads.
void  processUserAgentsSingle ()
Processes all the User-Agents in the file named in the shared state using the engine in the state using a single thread, and outputs the hash of the results.

Static Public Member Functions

static void  processUserAgentsMulti (void *state)
Calls the processUserAgentsSingle method with the state, then increments the number of threads finished counter. More...

Data Fields

EngineHash *  engine
Pointer to the engine.
volatile long  threadsFinished
Number of threads that have finished their processing.
string  userAgentFilePath
Path to the User-Agents to process.
thread  threads [THREAD_COUNT]
Pointers to the running threads.

Constructor & Destructor Documentation

◆ SharedState()

FiftyoneDegrees::Examples::Hash::ExampleBase::SharedState::SharedState ( EngineHash *   engine,
string   userAgentFilePath  
)

Construct a new shared state instance.

Parameters
engine - pointer to the engine the threads should use
userAgentFilePath - path to the User-Agents CSV

Member Function Documentation

◆ processUserAgentsMulti()

static void FiftyoneDegrees::Examples::Hash::ExampleBase::SharedState::processUserAgentsMulti ( void *   state )
static

Calls the processUserAgentsSingle method with the state, then increments the number of threads finished counter.

Parameters
state - pointer to a ExampleBase::SharedState to use

The documentation for this class was generated from the following file:
  • /home/runner/work/device-detection-cxx/device-detection-cxx/common/device-detection-cxx/examples/CPP/Hash/ExampleBase.hpp