From f51e6fbbc43cce135e1991f498b4b8b1e7e31129 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 11 Dec 2018 12:11:07 -0800 Subject: randtest: add test source --- src/main.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main.c diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..cd71df4 --- /dev/null +++ b/src/main.c @@ -0,0 +1,47 @@ +/* + * 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; +} -- cgit v1.2.3