31 class CbcSpecificThread {
37 CbcSpecificThread (CbcSpecificThread * master, pthread_mutex_t * masterMutex);
39 virtual ~CbcSpecificThread();
42 void setUsefulStuff (CbcSpecificThread * master,
54 void lockThread2(
bool doAnyway =
false);
56 void unlockThread2(
bool doAnyway =
false);
60 void timedWait(
int time);
62 void startThread(
void * (*routine ) (
void *),
CbcThread * thread);
70 void setStatus(
int value);
75 CbcSpecificThread * basePointer_;
77 pthread_mutex_t *masterMutex_;
78 pthread_mutex_t mutex2_;
79 pthread_cond_t condition2_;
80 Coin_pthread_t threadId_;
99 void setUsefulStuff (
CbcModel * model,
int deterministic,
102 void *& masterMutex);
114 inline bool isLocked()
const {
121 bool wait(
int type,
int currentCode);
123 void waitNano(
int time);
127 void lockFromMaster();
129 void unlockFromMaster();
131 void lockFromThread();
133 void unlockFromThread();
141 inline int status()
const {
142 return threadStuff_.status();
145 inline void setStatus(
int value) {
146 threadStuff_.setStatus( value);
149 inline int returnCode()
const {
153 inline void setReturnCode(
int value) {
157 inline CbcModel * baseModel()
const {
161 inline CbcModel * thisModel()
const {
165 inline CbcNode * node()
const {
169 inline void setNode(
CbcNode * node) {
173 inline CbcNode * createdNode()
const {
177 inline void setCreatedNode(
CbcNode * node) {
181 inline int dantzigState()
const {
182 return dantzigState_;
185 inline void setDantzigState(
int value) {
186 dantzigState_ = value;
189 inline double timeInThread()
const {
190 return timeInThread_;
193 inline void incrementTimeInThread(
double value) {
194 timeInThread_ += value;
197 inline double timeWaitingToStart()
const {
198 return timeWaitingToStart_;
201 inline void incrementTimeWaitingToStart(
double value) {
202 timeWaitingToStart_ += value;
205 inline double timeLocked()
const {
209 inline void incrementTimeLocked(
double value) {
210 timeLocked_ += value;
213 inline double timeWaitingToLock()
const {
214 return timeWaitingToLock_;
217 inline void incrementTimeWaitingToLock(
double value) {
218 timeWaitingToLock_ += value;
221 inline int deterministic()
const {
222 return deterministic_;
225 inline int maxDeleteNode()
const {
226 return maxDeleteNode_;
229 inline void setMaxDeleteNode(
int value) {
230 maxDeleteNode_ = value;
233 inline int nDeleteNode()
const {
237 inline void setNDeleteNode(
int value) {
238 nDeleteNode_ = value;
241 inline void clearDelNode() {
246 inline void fakeDelNode(
CbcNode ** delNode) {
250 inline CbcNode ** delNode()
const {
254 inline void setDelNode(
CbcNode ** delNode) {
258 inline int numberTimesLocked()
const {
259 return numberTimesLocked_;
262 inline int numberTimesUnlocked()
const {
263 return numberTimesUnlocked_;
266 inline int nodesThisTime()
const {
267 return nodesThisTime_;
270 inline void setNodesThisTime(
int value) {
271 nodesThisTime_ = value;
274 inline int iterationsThisTime()
const {
275 return iterationsThisTime_;
278 inline void setIterationsThisTime(
int value) {
279 iterationsThisTime_ = value;
282 inline int * saveStuff() {
286 inline bool locked()
const {
291 CbcSpecificThread threadStuff_;
299 double timeWaitingToLock_;
300 double timeWaitingToStart_;
301 double timeInThread_;
302 double timeWhenLocked_;
303 int numberTimesLocked_;
304 int numberTimesUnlocked_;
305 int numberTimesWaitingToStart_;
313 int iterationsThisTime_;
345 void stopThreads(
int type);
353 int waitForThreadsInTree(
int type);
359 void waitForThreadsInCuts(
int type, OsiCuts * eachCuts,
int whichGenerator);
362 void deterministicParallel();
367 inline void lockThread() {
368 children_[numberThreads_].lockThread();
373 inline void unlockThread() {
374 children_[numberThreads_].unlockThread();
378 inline bool isLocked()
const {
379 return children_[numberThreads_].locked();
386 inline CbcModel * model(
int i)
const {
387 return threadModel_[i];
391 void setDantzigState();
406 OsiObject ** saveObjects_;
408 int defaultParallelIterations_;
409 int defaultParallelNodes_;