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

Function threadEval

Singular/dyn_modules/systhreads/shared.cc:2922–2948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2920}
2921
2922BOOLEAN threadEval(leftv result, leftv arg) {
2923 if (wrong_num_args("threadEval", arg, 2))
2924 return TRUE;
2925 if (arg->Typ() != type_thread) {
2926 WerrorS("threadEval: argument is not a thread");
2927 return TRUE;
2928 }
2929 InterpreterThread *thread = *(InterpreterThread **)arg->Data();
2930 string expr = LinTree::to_string(arg->next);
2931 ThreadState *ts = thread->getThreadState();
2932 if (ts && ts->parent != pthread_self()) {
2933 WerrorS("threadEval: can only be called from parent thread");
2934 return TRUE;
2935 }
2936 if (ts) ts->lock.lock();
2937 if (!ts || !ts->running || !ts->active) {
2938 WerrorS("threadEval: thread is no longer running");
2939 if (ts) ts->lock.unlock();
2940 return TRUE;
2941 }
2942 ts->to_thread.push("e");
2943 ts->to_thread.push(expr);
2944 ts->to_cond.signal();
2945 ts->lock.unlock();
2946 result->rtyp = NONE;
2947 return FALSE;
2948}
2949
2950BOOLEAN threadExec(leftv result, leftv arg) {
2951 if (wrong_num_args("threadExec", arg, 2))

Callers

nothing calls this directly

Calls 10

wrong_num_argsFunction · 0.85
WerrorSFunction · 0.85
to_stringFunction · 0.85
getThreadStateMethod · 0.80
signalMethod · 0.80
TypMethod · 0.45
DataMethod · 0.45
lockMethod · 0.45
unlockMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected