votca 2024.2-dev
Loading...
Searching...
No Matches
votca::tools::Thread Class Referenceabstract

Framework for threaded execution. More...

#include <thread.h>

Inheritance diagram for votca::tools::Thread:

Public Member Functions

 Thread ()
 
virtual ~Thread ()
 
void Start ()
 Starts and runs a thread.
 
void WaitDone ()
 WaitDone() will not exit until thread ends computation.
 
bool IsFinished () const
 Checks to see if the thread is done.
 

Protected Member Functions

virtual void Run (void)=0
 Run() executes the actual code.
 

Private Attributes

pthread_attr_t attr_
 
pthread_t thread_
 
bool finished_
 

Friends

void * runwrapper (void *arg)
 

Detailed Description

Framework for threaded execution.

The Thread class handles the threaded execution of VOTCA code. In its current state, it is based on POSIX threads. It mainly contains a wrapper, a start and a wait function. This class should not be touched by the user.

Definition at line 35 of file thread.h.

Constructor & Destructor Documentation

◆ Thread()

votca::tools::Thread::Thread ( )
default

◆ ~Thread()

votca::tools::Thread::~Thread ( )
virtualdefault

Member Function Documentation

◆ IsFinished()

bool votca::tools::Thread::IsFinished ( ) const

Checks to see if the thread is done.

Returns
True if thread is done, False otherwise

Definition at line 77 of file thread.cc.

◆ Run()

virtual void votca::tools::Thread::Run ( void )
protectedpure virtual

Run() executes the actual code.

It is left blank here and must be overloaded, for the thread to do any work. This method should never be called by the user, it is called internally by the Start method.

Implemented in votca::csg::CsgApplication::Worker, votca::xtp::ParallelXJobCalc< JobContainer >::JobOperator, and votca::xtp::QMThread.

◆ Start()

void votca::tools::Thread::Start ( )

Starts and runs a thread.

This method is responsible for creating and running the thread.

Definition at line 42 of file thread.cc.

◆ WaitDone()

void votca::tools::Thread::WaitDone ( )

WaitDone() will not exit until thread ends computation.

Definition at line 66 of file thread.cc.

Friends And Related Symbol Documentation

◆ runwrapper

void * runwrapper ( void * arg)
friend

Definition at line 31 of file thread.cc.

Member Data Documentation

◆ attr_

pthread_attr_t votca::tools::Thread::attr_
private

Definition at line 71 of file thread.h.

◆ finished_

bool votca::tools::Thread::finished_
private

Definition at line 73 of file thread.h.

◆ thread_

pthread_t votca::tools::Thread::thread_
private

Definition at line 72 of file thread.h.


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