Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
Worker< CONF > Class Template Reference

#include "vault/gear/work-force.hpp"

Description

template<class CONF>
class vault::gear::work::Worker< CONF >

Individual worker thread: repeatedly pulls the doWork functor.

Definition at line 127 of file work-force.hpp.

Public Attributes

std::atomic< bool > emergency {false}
 emergency break to trigger cooperative halt
 

Public Member Functions

 Worker (CONF config)
 
bool isDead () const
 this Worker starts out active, but may terminate
 

Private Member Functions

void pullWork ()
 
activity::Proc idleWait ()
 
activity::Proc contentionWait ()
 
- Private Member Functions inherited from NonCopyable
 ~NonCopyable ()=default
 
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Private Attributes

lib::Thread thread_
 
size_t idleCycles_ {0}
 
size_t kickLevel_ {0}
 
size_t randFact_ {0}
 

Constructor & Destructor Documentation

◆ Worker()

template<class CONF >
Worker ( CONF  config)
inline

Definition at line 132 of file work-force.hpp.

Member Function Documentation

◆ isDead()

template<class CONF >
bool isDead ( ) const
inline

this Worker starts out active, but may terminate

Definition at line 143 of file work-force.hpp.

References Worker< CONF >::thread_.

◆ pullWork()

template<class CONF >
void pullWork ( )
inlineprivate

Definition at line 150 of file work-force.hpp.

References ASSERT_MEMBER_FUNCTOR, Worker< CONF >::contentionWait(), Worker< CONF >::emergency, ERROR_LOG_AND_IGNORE, Worker< CONF >::idleCycles_, Worker< CONF >::idleWait(), vault::gear::activity::KICK, Worker< CONF >::kickLevel_, vault::gear::activity::PASS, and vault::gear::activity::WAIT.

+ Here is the call graph for this function:

◆ idleWait()

template<class CONF >
activity::Proc idleWait ( )
inlineprivate

Definition at line 187 of file work-force.hpp.

References vault::gear::activity::HALT, Worker< CONF >::idleCycles_, and vault::gear::activity::PASS.

Referenced by Worker< CONF >::pullWork().

+ Here is the caller graph for this function:

◆ contentionWait()

template<class CONF >
activity::Proc contentionWait ( )
inlineprivate

Definition at line 202 of file work-force.hpp.

References Worker< CONF >::kickLevel_, util::min(), vault::gear::activity::PASS, vault::gear::work::performRandomisedSpin(), Worker< CONF >::randFact_, and vault::gear::work::steppedRandDelay().

Referenced by Worker< CONF >::pullWork().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ emergency

template<class CONF >
std::atomic<bool> emergency {false}

emergency break to trigger cooperative halt

Definition at line 140 of file work-force.hpp.

Referenced by Worker< CONF >::pullWork().

◆ thread_

template<class CONF >
lib::Thread thread_
private

Definition at line 147 of file work-force.hpp.

Referenced by Worker< CONF >::isDead().

◆ idleCycles_

template<class CONF >
size_t idleCycles_ {0}
private

Definition at line 198 of file work-force.hpp.

Referenced by Worker< CONF >::idleWait(), and Worker< CONF >::pullWork().

◆ kickLevel_

template<class CONF >
size_t kickLevel_ {0}
private

Definition at line 223 of file work-force.hpp.

Referenced by Worker< CONF >::contentionWait(), and Worker< CONF >::pullWork().

◆ randFact_

template<class CONF >
size_t randFact_ {0}
private

Definition at line 224 of file work-force.hpp.

Referenced by Worker< CONF >::contentionWait().

+ Inheritance diagram for Worker< CONF >:
+ Collaboration diagram for Worker< CONF >:

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