| 157 | } |
| 158 | |
| 159 | void |
| 160 | ThreadSync::wrapperExecutionLockLock() |
| 161 | { |
| 162 | int saved_errno = errno; |
| 163 | |
| 164 | // The process is still initializing. We don't need to acquire lock. |
| 165 | if (WorkerState::currentState() == WorkerState::UNKNOWN) { |
| 166 | return; |
| 167 | } |
| 168 | |
| 169 | Thread *thread = dmtcp_get_current_thread(); |
| 170 | |
| 171 | if (thread->wrapperLockCount == 0) { |
| 172 | // If we don't have a lock, acquire it now. |
| 173 | if (DmtcpRWLockRdLock(&_wrapperExecutionLock) != 0) { |
| 174 | fprintf(stderr, "ERROR %d at %s:%d %s: Failed to acquire lock\n", |
| 175 | errno, __FILE__, __LINE__, __PRETTY_FUNCTION__); |
| 176 | _exit(DMTCP_FAIL_RC); |
| 177 | } |
| 178 | } |
| 179 | thread->wrapperLockCount++; |
| 180 | |
| 181 | errno = saved_errno; |
| 182 | } |
| 183 | |
| 184 | void |
| 185 | ThreadSync::wrapperExecutionLockLockForNewThread(Thread *thread) |
nothing calls this directly
no test coverage detected