| 2948 | } |
| 2949 | |
| 2950 | BOOLEAN threadExec(leftv result, leftv arg) { |
| 2951 | if (wrong_num_args("threadExec", arg, 2)) |
| 2952 | return TRUE; |
| 2953 | if (arg->Typ() != type_thread) { |
| 2954 | WerrorS("threadExec: argument is not a thread"); |
| 2955 | return TRUE; |
| 2956 | } |
| 2957 | InterpreterThread *thread = *(InterpreterThread **)arg->Data(); |
| 2958 | string expr = LinTree::to_string(arg->next); |
| 2959 | ThreadState *ts = thread->getThreadState(); |
| 2960 | if (ts && ts->parent != pthread_self()) { |
| 2961 | WerrorS("threadExec: can only be called from parent thread"); |
| 2962 | return TRUE; |
| 2963 | } |
| 2964 | if (ts) ts->lock.lock(); |
| 2965 | if (!ts || !ts->running || !ts->active) { |
| 2966 | WerrorS("threadExec: thread is no longer running"); |
| 2967 | if (ts) ts->lock.unlock(); |
| 2968 | return TRUE; |
| 2969 | } |
| 2970 | ts->to_thread.push("x"); |
| 2971 | ts->to_thread.push(expr); |
| 2972 | ts->to_cond.signal(); |
| 2973 | ts->lock.unlock(); |
| 2974 | result->rtyp = NONE; |
| 2975 | return FALSE; |
| 2976 | } |
| 2977 | |
| 2978 | BOOLEAN threadPoolExec(leftv result, leftv arg) { |
| 2979 | Command cmd("threadPoolExec", result, arg); |
nothing calls this directly
no test coverage detected