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

Method wrapperExecutionLockLockExcl

src/threadsync.cpp:249–268  ·  view source on GitHub ↗

* Execute fork() and exec() wrappers in exclusive mode * * fork() and exec() wrappers pass on the state/information about the current * process/program to the to-be-created process/program. * * There can be a potential race in the wrappers if this information gets * changed between the point where it was acquired and the point where the * process/program is created. An example of this situa

Source from the content-addressed store, hash-verified

247 * repeated calls to _real_epoll_wait with smaller timeout.
248 */
249void
250ThreadSync::wrapperExecutionLockLockExcl()
251{
252 int saved_errno = errno;
253
254 // The process is still initializing. We don't need to acquire lock.
255 if (WorkerState::currentState() == WorkerState::UNKNOWN) {
256 return;
257 }
258
259 Thread *thread = dmtcp_get_current_thread();
260
261 if (DmtcpRWLockWrLock(&_wrapperExecutionLock) != 0) {
262 fprintf(stderr, "ERROR %s:%d %s: Failed to acquire lock\n",
263 __FILE__, __LINE__, __PRETTY_FUNCTION__);
264 _exit(DMTCP_FAIL_RC);
265 }
266 thread->wrapperLockCount++;
267 errno = saved_errno;
268}
269
270// NOTE: Don't do any fancy stuff in this wrapper which can cause the process
271// to go into DEADLOCK

Callers

nothing calls this directly

Calls 3

currentStateFunction · 0.85
dmtcp_get_current_threadFunction · 0.85
DmtcpRWLockWrLockFunction · 0.85

Tested by

no test coverage detected