MCPcopy Create free account
hub / github.com/Singular/Singular / joinInterpreterThread

Function joinInterpreterThread

Singular/dyn_modules/systhreads/shared.cc:1507–1524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1505}
1506
1507static bool joinInterpreterThread(InterpreterThread *thread) {
1508 ThreadState *ts = thread->getThreadState();
1509 if (ts && ts->parent != pthread_self()) {
1510 return false;
1511 }
1512 ts->lock.lock();
1513 string quit("q");
1514 ts->to_thread.push(quit);
1515 ts->to_cond.signal();
1516 ts->lock.unlock();
1517 pthread_join(ts->id, NULL);
1518 thread_lock.lock();
1519 ts->running = false;
1520 ts->active = false;
1521 thread->clearThreadState();
1522 thread_lock.unlock();
1523 return true;
1524}
1525
1526static BOOLEAN joinThread(leftv result, leftv arg) {
1527 if (wrong_num_args("joinThread", arg, 1))

Callers 1

joinThreadFunction · 0.85

Calls 6

getThreadStateMethod · 0.80
signalMethod · 0.80
lockMethod · 0.45
pushMethod · 0.45
unlockMethod · 0.45
clearThreadStateMethod · 0.45

Tested by

no test coverage detected