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

Method createCkptThread

src/threadlist.cpp:207–232  ·  view source on GitHub ↗

* *****************************************************************************/

Source from the content-addressed store, hash-verified

205 *
206 *****************************************************************************/
207void
208ThreadList::createCkptThread()
209{
210 sem_init(&sem_launch, 0, 0);
211 sem_init(&semNotifyCkptThread, 0, 0);
212 sem_init(&semWaitForCkptThreadSignal, 0, 0);
213
214 SigInfo::setupCkptSigHandler(&stopthisthread);
215
216 originalstartup = true;
217 pthread_t checkpointhreadid;
218
219 /* Spawn off a thread that will perform the checkpoints from time to time */
220 JASSERT(pthread_create(&checkpointhreadid, NULL, checkpointhread, NULL) == 0);
221
222 /* Stop until checkpoint thread has finished initializing.
223 * Some programs (like gcl) implement their own glibc functions in
224 * a non-thread-safe manner. In case we're using non-thread-safe glibc,
225 * don't run the checkpoint thread and user thread at the same time.
226 */
227 errno = 0;
228 while (-1 == sem_wait(&sem_launch) && errno == EINTR) {
229 errno = 0;
230 }
231 sem_destroy(&sem_launch);
232}
233
234/*****************************************************************************
235 *

Callers

nothing calls this directly

Calls 1

pthread_createFunction · 0.85

Tested by

no test coverage detected