C++ Concurrency Sandbox
Loading...
Searching...
No Matches
HeavyTask Struct Reference

A simulated CPU-intensive workload functor. More...

Collaboration diagram for HeavyTask:

Public Member Functions

void operator() () const
 Executes the simulated work by sleeping the worker thread.
 

Public Attributes

int duration_ms
 Time in milliseconds the task will "occupy" the worker.
 

Detailed Description

A simulated CPU-intensive workload functor.

  • This functor is used to occupy worker threads for a specific duration, allowing the priority queue to fill up and the aging monitor to trigger.

Definition at line 177 of file AgingPriority.cpp.

Member Function Documentation

◆ operator()()

void HeavyTask::operator() ( ) const
inline

Executes the simulated work by sleeping the worker thread.

Definition at line 183 of file AgingPriority.cpp.

183 {
184 std::this_thread::sleep_for(milliseconds(duration_ms));
185 }
int duration_ms
Time in milliseconds the task will "occupy" the worker.

References duration_ms.

Member Data Documentation

◆ duration_ms

int HeavyTask::duration_ms

Time in milliseconds the task will "occupy" the worker.

Definition at line 178 of file AgingPriority.cpp.

Referenced by operator()().


The documentation for this struct was generated from the following file: