Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
thread_spawn.c
Go to the documentation of this file.
1/*
2 * This file is part of the Fun programming language.
3 * https://fun-lang.xyz/
4 *
5 * Copyright 2025 Johannes Findeisen <you@hanez.org>
6 * Licensed under the terms of the Apache-2.0 license.
7 * https://opensource.org/license/apache-2-0
8 */
9
21
23 /* operand: 0 -> no args; 1 -> has args array or single arg */
24 Value argsMaybe = make_nil();
25 if (inst.operand == 1) {
26 argsMaybe = pop_value(vm); /* maybe array or scalar */
27 }
28 Value fnv = pop_value(vm);
29 int tid = fun_thread_spawn(fnv, argsMaybe, inst.operand == 1);
31 if (inst.operand == 1) free_value(argsMaybe);
33 break;
34}
@ OP_THREAD_SPAWN
Definition bytecode.h:151
Value fnv
Definition call.c:40
Tagged union representing a Fun value.
Definition value.h:68
push_value(vm, make_int(tid))
int tid
free_value(fnv)
Value make_nil(void)
Construct a nil Value.
Definition value.c:126
Value make_int(int64_t v)
Construct a Value representing a 64-bit integer.
Definition value.c:51