lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::TaskObject Class Reference

Thread parameters of a Task: name, priority, stack size and base, queue size and pthread attributes, plus the thread ID once created. More...

#include <TaskObject.hh>

Public Types

enum  { THR_DETACHED = 1 << 1 }
 Thread creation flags. More...
 

Public Member Functions

 TaskObject (const char *name, int priority=127, int stackSize=20 *1024, char *stackBase=NULL, int queueSize=0, unsigned flags=THR_DETACHED)
 Copy name, clamp priority to 0-127 and store 127 minus it, keep the stack size (raised to the pthread default minimum if smaller and non-zero), stack base and queue size, and set the detached attribute if flags has THR_DETACHED.
 
 TaskObject (const TaskObject &tparam)
 Copy all parameters of tparam, including the pthread attributes and thread ID (the name is duplicated).
 
 TaskObject ()
 Parameters of the calling thread: no name, zero stack size, default attributes, the caller thread ID and the default scheduling priority (clamped and inverted).
 
void operator= (const TaskObject &)
 Replace all parameters with copies of those of the argument (the name is duplicated).
 
 ~TaskObject ()
 Destroy the pthread attributes and free the name.
 
char * name () const
 Return the task name (null for the default-constructed object).
 
int priority () const
 Return the stored priority (127 minus the requested value).
 
char * stackBase () const
 Return the stack base given to the constructor.
 
int stackSize () const
 Return the stack size in bytes.
 
pthread_t taskID () const
 Return the pthread ID (set when the thread is created, or the caller ID for the default object).
 
int queueSize () const
 Return the queue size given to the constructor.
 

Friends

class Task
 Lets Task use the private attributes and thread ID.
 
class SpinTask
 Lets SpinTask use the private attributes and thread ID.
 

Detailed Description

Thread parameters of a Task: name, priority, stack size and base, queue size and pthread attributes, plus the thread ID once created.

Priorities are given in the range 0 (highest) to 127 and stored inverted (127 minus the value), per the header note.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Thread creation flags.

Enumerator
THR_DETACHED 

Create the thread detached (1 shifted left by 1); otherwise joinable.

Constructor & Destructor Documentation

◆ TaskObject() [1/3]

Pds::TaskObject::TaskObject ( const char *  name,
int  priority = 127,
int  stackSize = 20 *1024,
char *  stackBase = NULL,
int  queueSize = 0,
unsigned  flags = THR_DETACHED 
)

Copy name, clamp priority to 0-127 and store 127 minus it, keep the stack size (raised to the pthread default minimum if smaller and non-zero), stack base and queue size, and set the detached attribute if flags has THR_DETACHED.

◆ TaskObject() [2/3]

Pds::TaskObject::TaskObject ( const TaskObject &  tparam)

Copy all parameters of tparam, including the pthread attributes and thread ID (the name is duplicated).

◆ TaskObject() [3/3]

Pds::TaskObject::TaskObject ( )

Parameters of the calling thread: no name, zero stack size, default attributes, the caller thread ID and the default scheduling priority (clamped and inverted).

◆ ~TaskObject()

Pds::TaskObject::~TaskObject ( )

Destroy the pthread attributes and free the name.

Member Function Documentation

◆ name()

char * Pds::TaskObject::name ( ) const
inline

Return the task name (null for the default-constructed object).

◆ operator=()

void Pds::TaskObject::operator= ( const TaskObject &  )

Replace all parameters with copies of those of the argument (the name is duplicated).

◆ priority()

int Pds::TaskObject::priority ( ) const
inline

Return the stored priority (127 minus the requested value).

◆ queueSize()

int Pds::TaskObject::queueSize ( ) const
inline

Return the queue size given to the constructor.

◆ stackBase()

char * Pds::TaskObject::stackBase ( ) const
inline

Return the stack base given to the constructor.

◆ stackSize()

int Pds::TaskObject::stackSize ( ) const
inline

Return the stack size in bytes.

◆ taskID()

pthread_t Pds::TaskObject::taskID ( ) const
inline

Return the pthread ID (set when the thread is created, or the caller ID for the default object).

Friends And Related Symbol Documentation

◆ SpinTask

friend class SpinTask
friend

Lets SpinTask use the private attributes and thread ID.

◆ Task

friend class Task
friend

Lets Task use the private attributes and thread ID.


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