2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
25 fn box_new(w : world, t : type, v : t) : (world, box(t));
26 fn box_set(w : world, t : type, b : box(t), v : t) : world;
27 fn box_get(w : world, t : type, b : box(t)) : (world, t);
33 type box(t : type) := msgqueue(t);
35 fn box_new(implicit w : world, t : type, v : t) : (world, box(t))
37 var b := msgqueue_new(t);
42 fn box_set(implicit w : world, t : type, b : box(t), v : t) : world
44 msgqueue_replace(b, 0, v);
47 fn box_get(implicit w : world, t : type, b : box(t)) : (world, t)
49 var tag, val := msgqueue_peek_nonblock(b);