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

Method wrapperExecutionLockLock

src/threadsync.cpp:159–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void
160ThreadSync::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
184void
185ThreadSync::wrapperExecutionLockLockForNewThread(Thread *thread)

Callers

nothing calls this directly

Calls 3

currentStateFunction · 0.85
dmtcp_get_current_threadFunction · 0.85
DmtcpRWLockRdLockFunction · 0.85

Tested by

no test coverage detected