diff options
| -rw-r--r-- | src/main.c | 47 | 
1 files changed, 47 insertions, 0 deletions
| 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 - <vcaputo@pengaru.com> + * + *  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 <http://www.gnu.org/licenses/>. + */ + +#include <pulp.h> +#include <stdio.h> +#include <stdlib.h> +#include <thunk.h> + + +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; +} | 
