Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
lm::thread::Thread Class Referenceabstract

A base class wrapping pthreads. More...

#include <Thread.h>

Inheritance diagram for lm::thread::Thread:
[legend]

Public Member Functions

 Thread ()
 Creates a pthread locking mechanism and initializes "Thread".
virtual ~Thread ()
 Destory the Thread.
virtual void start ()
 If no thread exists, creates a new thread and begins execution.
virtual void stop ()
 Joins the thread with the parent waiting if necessary.
virtual void wake ()=0
 Wakes a sleeping thead.
virtual pthread_t getId ()
 Returns the pthread based id for the Thread.
virtual void setAffinity (int cpuNumber)
 Binds the thread to a CPU core.

Protected Member Functions

virtual int run ()=0

Protected Attributes

pthread_mutex_t controlMutex
pthread_t threadId
volatile bool running
int cpuNumber

Detailed Description

A base class wrapping pthreads.

Constructor & Destructor Documentation

◆ Thread()

lm::thread::Thread::Thread ( )

Creates a pthread locking mechanism and initializes "Thread".

◆ ~Thread()

lm::thread::Thread::~Thread ( )
virtual

Destory the Thread.

Member Function Documentation

◆ getId()

virtual pthread_t lm::thread::Thread::getId ( )
inlinevirtual

Returns the pthread based id for the Thread.

Returns
pthread assigned id

◆ run()

virtual int lm::thread::Thread::run ( )
protectedpure virtual

◆ setAffinity()

void lm::thread::Thread::setAffinity ( int cpuNumber)
virtual

Binds the thread to a CPU core.

Parameters
Thecpu core for which to bind the thread
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void lm::thread::Thread::start ( )
virtual

If no thread exists, creates a new thread and begins execution.

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

◆ stop()

void lm::thread::Thread::stop ( )
virtual

Joins the thread with the parent waiting if necessary.

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

◆ wake()

virtual void lm::thread::Thread::wake ( )
pure virtual

Wakes a sleeping thead.

Implemented in lm::main::CheckpointSignaler, lm::main::LocalDataOutputWorker, lm::main::ReplicateRunner, lm::main::SignalHandler, and ReplicateRunner.

Here is the caller graph for this function:

Member Data Documentation

◆ controlMutex

pthread_mutex_t lm::thread::Thread::controlMutex
protected

◆ cpuNumber

int lm::thread::Thread::cpuNumber
protected

◆ running

volatile bool lm::thread::Thread::running
protected

◆ threadId

pthread_t lm::thread::Thread::threadId
protected

The documentation for this class was generated from the following files:
  • /data2/LM_zls_github/Lattice-Microbes/src/thread/Thread.h
  • /data2/LM_zls_github/Lattice-Microbes/src/thread/Thread.cpp