Project

General

Profile

Download (1014 Bytes) Statistics
| Branch: | Tag: | Revision:
7e8045d8 David Sorber
/**
* Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl
*
*/
#ifndef TODO_H
#define TODO_H

/* This is a scheduler for a simple to-do list. You create a todo_list and
* then you start it running with some workers with an initial todo item. The
* workers pop things from the todo list (and the work function can push more
* things on) until everything is done.
*/

#include <stddef.h>

struct todo_item;
struct todo_list;

struct todo_list *
mk_todo_list(void);

struct todo_list *
todo_list_destroy(struct todo_list *todo_list);

void
todo_list_push(struct todo_list *tl,
struct todo_item *item);

void
todo_list_run(struct todo_list *todo_list,
size_t n_threads,
struct todo_item *first_item,
void (*work_on_item_function)(struct todo_list *,
struct todo_item *));

#endif