| 2920 | } |
| 2921 | |
| 2922 | BOOLEAN 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 | |
| 2950 | BOOLEAN threadExec(leftv result, leftv arg) { |
| 2951 | if (wrong_num_args("threadExec", arg, 2)) |
nothing calls this directly
no test coverage detected