/* * Copyright (C) 2018 Vito Caputo - * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3 as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include THUNK_DEFINE(randy, pulp_t *, p) { printf("%i\n", rand()); pulp_msleep(p, 1000, NULL); printf("%i\n", rand()); return 0; } int main(int argc, char *argv[]) { pulp_t *p; pulp_init(); p = pulp_new(); for (int i = 0; i < 100; i++) (void) pulp_fiber_new(p, 0, THUNK(randy(p))); pulp_run(p); pulp_free(p); return 0; }