A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
PDBWorker.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* *
3
* Copyright 2018 Rice University *
4
* *
5
* Licensed under the Apache License, Version 2.0 (the "License"); *
6
* you may not use this file except in compliance with the License. *
7
* You may obtain a copy of the License at *
8
* *
9
* http://www.apache.org/licenses/LICENSE-2.0 *
10
* *
11
* Unless required by applicable law or agreed to in writing, software *
12
* distributed under the License is distributed on an "AS IS" BASIS, *
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14
* See the License for the specific language governing permissions and *
15
* limitations under the License. *
16
* *
17
*****************************************************************************/
18
/*
19
* File: PDBWorker.h
20
* Author: Chris
21
*
22
* Created on September 25, 2015, 5:11 PM
23
*/
24
25
#ifndef PDBWORKER_H
26
#define PDBWORKER_H
27
28
// create a smart pointer for PDBWorker objects
29
#include <memory>
30
#include "
PDBAlarm.h
"
31
#include "
PDBBuzzer.h
"
32
#include "
PDBWork.h
"
33
#include "
PDBWorkerQueue.h
"
34
35
// this class wraps up a thread... note that PDBWorker objects should always be created
36
// by the PDBWorkerQueue class.
37
38
namespace
pdb {
39
40
class
PDBWorker
;
41
typedef
shared_ptr<PDBWorker>
PDBWorkerPtr
;
42
43
class
PDBWork
;
44
typedef
shared_ptr<PDBWork>
PDBWorkPtr
;
45
46
class
PDBWorker
{
47
public
:
48
// constructor... accepts the work queue that is creating it
49
PDBWorker
(
PDBWorkerQueue
*
parent
);
50
51
// destructor
52
~PDBWorker
();
53
54
// gets another worder from the same work queue that this guy came from... note that
55
// this call can block if the work queue does not have any additional workers
56
PDBWorkerPtr
getWorker
();
57
58
// asks this worker to execute runMe... this call is non-blocking. When the task
59
// is done, myBuzzer->buzz () should be called.
60
void
execute
(
PDBWorkPtr
runMe
,
PDBBuzzerPtr
myBuzzer);
61
62
// directly sound the buzzer on this guy to wake him if he is sleeping
63
void
soundBuzzer
(
PDBAlarm
withMe);
64
65
// gets access to the logger
66
PDBLoggerPtr
getLogger
();
67
68
// entry point for a thread
69
void
enter
();
70
71
// this resets the contents
72
void
reset
();
73
74
private
:
75
// the work queue we came from
76
PDBWorkerQueue
*
parent
;
77
78
// the work to run
79
PDBWorkPtr
runMe
;
80
81
// used to signal when we are done, or when some event happens
82
PDBBuzzerPtr
buzzWhenDone
;
83
84
// for coordinating the thread who is running this guy
85
pthread_mutex_t
workerMutex
;
86
pthread_cond_t
workToDoSignal
;
87
88
// set to true when the worker is able to go and do the work
89
bool
okToExecute
;
90
};
91
}
92
93
#endif
/* PDBWORKER_H */
pdb::PDBWork
Definition:
PDBWork.h:50
pdb::PDBWorker::workerMutex
pthread_mutex_t workerMutex
Definition:
PDBWorker.h:85
pdb::PDBWorker::okToExecute
bool okToExecute
Definition:
PDBWorker.h:89
pdb::PDBWorker::enter
void enter()
Definition:
PDBWorker.cc:57
pdb::PDBWorker
Definition:
PDBWorker.h:46
pdb::PDBWorkPtr
shared_ptr< PDBWork > PDBWorkPtr
Definition:
PDBWork.h:47
pdb::PDBWorker::parent
PDBWorkerQueue * parent
Definition:
PDBWorker.h:76
pdb::PDBWorker::execute
void execute(PDBWorkPtr runMe, PDBBuzzerPtr myBuzzer)
Definition:
PDBWorker.cc:43
pdb::PDBWorker::runMe
PDBWorkPtr runMe
Definition:
PDBWorker.h:79
pdb::PDBWorker::reset
void reset()
Definition:
PDBWorker.cc:73
pdb::PDBWorker::buzzWhenDone
PDBBuzzerPtr buzzWhenDone
Definition:
PDBWorker.h:82
PDBBuzzer.h
PDBBuzzerPtr
shared_ptr< PDBBuzzer > PDBBuzzerPtr
Definition:
PDBBuzzer.h:32
pdb::PDBWorker::getWorker
PDBWorkerPtr getWorker()
Definition:
PDBWorker.cc:35
pdb::PDBWorkerPtr
shared_ptr< PDBWorker > PDBWorkerPtr
Definition:
PDBWorker.h:40
pdb::PDBWorker::workToDoSignal
pthread_cond_t workToDoSignal
Definition:
PDBWorker.h:86
PDBAlarm
PDBAlarm
Definition:
PDBAlarm.h:28
pdb::PDBWorkerQueue
Definition:
PDBWorkerQueue.h:48
pdb::PDBLoggerPtr
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition:
PDBLogger.h:40
PDBAlarm.h
pdb::PDBWorker::PDBWorker
PDBWorker(PDBWorkerQueue *parent)
Definition:
PDBWorker.cc:29
PDBWork.h
pdb::PDBWorker::soundBuzzer
void soundBuzzer(PDBAlarm withMe)
Definition:
PDBWorker.cc:51
pdb::PDBWorker::getLogger
PDBLoggerPtr getLogger()
Definition:
PDBWorker.cc:39
pdb::PDBWorker::~PDBWorker
~PDBWorker()
Definition:
PDBWorker.cc:78
PDBWorkerQueue.h
plinycompute
pdb
src
work
headers
PDBWorker.h
Generated on Mon Jun 18 2018 18:10:37 by
1.8.6