1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2005 - 2017 Christian Schoenebeck * |
* Copyright (C) 2005 - 2020 Christian Schoenebeck * |
4 |
* * |
* * |
5 |
* This library is free software; you can redistribute it and/or modify * |
* This library is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
98 |
|
|
99 |
// Entry point for the task thread. |
// Entry point for the task thread. |
100 |
int InstrumentManagerThread::Main() { |
int InstrumentManagerThread::Main() { |
101 |
|
#if DEBUG |
102 |
|
Thread::setNameOfCaller("InstrumentMngr"); |
103 |
|
#endif |
104 |
|
|
105 |
while (true) { |
while (true) { |
106 |
|
|
|
#if CONFIG_PTHREAD_TESTCANCEL |
|
107 |
TestCancel(); |
TestCancel(); |
108 |
#endif |
|
109 |
|
// prevent thread from being cancelled |
110 |
|
// (e.g. to prevent deadlocks while holding mutex lock(s)) |
111 |
|
pushCancelable(false); |
112 |
|
|
113 |
while (true) { |
while (true) { |
114 |
command_t cmd; |
command_t cmd; |
152 |
} |
} |
153 |
} |
} |
154 |
|
|
155 |
|
// now allow thread being cancelled again |
156 |
|
// (since all mutexes are now unlocked) |
157 |
|
popCancelable(); |
158 |
|
|
159 |
// nothing left to do, sleep until new jobs arrive |
// nothing left to do, sleep until new jobs arrive |
160 |
conditionJobsLeft.WaitIf(false); |
conditionJobsLeft.WaitIf(false); |
161 |
// reset flag |
// reset flag |