| 94 | |
| 95 | |
| 96 | bool ThreadMgr::Release(const int machineId) |
| 97 | { |
| 98 | mtx.lock(); |
| 99 | |
| 100 | bool ret; |
| 101 | const unsigned m = static_cast<unsigned>(machineId); |
| 102 | const int r = machineThreads[m]; |
| 103 | const unsigned ru = static_cast<unsigned>(r); |
| 104 | |
| 105 | if (r == -1) |
| 106 | { |
| 107 | // Error: Not in use. |
| 108 | ret = false; |
| 109 | } |
| 110 | else if (! realThreads[ru]) |
| 111 | { |
| 112 | // Error: Refers to a real thread that is not in use. |
| 113 | ret = false; |
| 114 | } |
| 115 | else |
| 116 | { |
| 117 | realThreads[ru] = false; |
| 118 | machineThreads[m] = -1; |
| 119 | ret = true; |
| 120 | } |
| 121 | |
| 122 | mtx.unlock(); |
| 123 | return ret; |
| 124 | } |
| 125 | |
| 126 | |
| 127 | void ThreadMgr::Print( |
nothing calls this directly
no outgoing calls
no test coverage detected