votca
2024.2-dev
Loading...
Searching...
No Matches
tools
include
votca
tools
thread.h
Go to the documentation of this file.
1
/*
2
* Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
18
#ifndef VOTCA_TOOLS_THREAD_H
19
#define VOTCA_TOOLS_THREAD_H
20
21
// Standard includes
22
#include <pthread.h>
23
24
namespace
votca
{
25
namespace
tools {
26
35
class
Thread
{
36
public
:
37
Thread
();
38
virtual
~Thread
();
39
45
void
Start
();
46
50
void
WaitDone
();
51
57
bool
IsFinished
()
const
;
58
59
protected
:
67
virtual
void
Run
(
void
) = 0;
68
friend
void
*
runwrapper
(
void
*arg);
69
70
private
:
71
pthread_attr_t
attr_
;
72
pthread_t
thread_
;
73
bool
finished_
;
74
};
75
}
// namespace tools
76
}
// namespace votca
77
78
#endif
// VOTCA_TOOLS_THREAD_H
votca::tools::Thread
Framework for threaded execution.
Definition
thread.h:35
votca::tools::Thread::finished_
bool finished_
Definition
thread.h:73
votca::tools::Thread::thread_
pthread_t thread_
Definition
thread.h:72
votca::tools::Thread::runwrapper
friend void * runwrapper(void *arg)
Definition
thread.cc:31
votca::tools::Thread::Run
virtual void Run(void)=0
Run() executes the actual code.
votca::tools::Thread::attr_
pthread_attr_t attr_
Definition
thread.h:71
votca::tools::Thread::WaitDone
void WaitDone()
WaitDone() will not exit until thread ends computation.
Definition
thread.cc:66
votca::tools::Thread::Start
void Start()
Starts and runs a thread.
Definition
thread.cc:42
votca::tools::Thread::Thread
Thread()
votca::tools::Thread::~Thread
virtual ~Thread()
votca::tools::Thread::IsFinished
bool IsFinished() const
Checks to see if the thread is done.
Definition
thread.cc:77
votca
base class for all analysis tools
Definition
basebead.h:33
Generated by
1.12.0