MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / wrapperExecutionLockUnlock

Method wrapperExecutionLockUnlock

src/threadsync.cpp:272–295  ·  view source on GitHub ↗

NOTE: Don't do any fancy stuff in this wrapper which can cause the process to go into DEADLOCK

Source from the content-addressed store, hash-verified

270// NOTE: Don't do any fancy stuff in this wrapper which can cause the process
271// to go into DEADLOCK
272void
273ThreadSync::wrapperExecutionLockUnlock()
274{
275 int saved_errno = errno;
276
277 // The process is still initializing. We don't need to acquire lock.
278 if (WorkerState::currentState() == WorkerState::UNKNOWN) {
279 return;
280 }
281
282 Thread *thread = dmtcp_get_current_thread();
283
284 JASSERT(thread->wrapperLockCount != 0);
285 thread->wrapperLockCount -= 1;
286
287 if (thread->wrapperLockCount == 0 &&
288 DmtcpRWLockUnlock(&_wrapperExecutionLock) != 0) {
289 fprintf(stderr, "ERROR %s:%d %s: Failed to release lock.\n",
290 __FILE__, __LINE__, __PRETTY_FUNCTION__);
291 _exit(DMTCP_FAIL_RC);
292 }
293
294 errno = saved_errno;
295}
296
297// GNU g++ uses __thread. But the C++0x standard says to use thread_local.
298// If your compiler fails here, you can: change "__thread" to "thread_local";

Callers

nothing calls this directly

Calls 3

currentStateFunction · 0.85
dmtcp_get_current_threadFunction · 0.85
DmtcpRWLockUnlockFunction · 0.85

Tested by

no test coverage detected