Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
thread_join.c File Reference

Implements OP_THREAD_JOIN to wait for a spawned thread and get its result. More...

Go to the source code of this file.

Functions

 if (vtid.type !=VAL_INT)
 free_value (vtid)
 push_value (vm, res)

Variables

case OP_THREAD_JOIN
Value res = fun_thread_join((int)vtid.i)
 break

Detailed Description

Implements OP_THREAD_JOIN to wait for a spawned thread and get its result.

Behavior:

  • Pops thread id (int); waits for the thread to finish; pushes the result Value produced by the thread.
  • If the thread failed or id is invalid, pushes Nil.

Errors:

  • If argument type is wrong, prints an error and pushes Nil.

Definition in file thread_join.c.

Function Documentation

◆ free_value()

free_value(vtid)
Here is the caller graph for this function:

◆ if()

if(vtid.type ! = VAL_INT)

Definition at line 24 of file thread_join.c.

Here is the call graph for this function:

◆ push_value()

push_value(vm,
res )
Here is the caller graph for this function:

Variable Documentation

◆ break

break

Definition at line 33 of file thread_join.c.

◆ OP_THREAD_JOIN

case OP_THREAD_JOIN

Definition at line 22 of file thread_join.c.

◆ res

Value res = fun_thread_join((int)vtid.i)

Definition at line 30 of file thread_join.c.