/**
 * 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 SCHED_H
#define SCHED_H
#include <stddef.h>

struct frame;

typedef struct frame *(*continuation_t)(struct frame *frame, void *app_frame);
typedef void (*inlet_t)(void *parent_app_frame, size_t result);

struct frame * sched_spawn(struct frame   *parent,
                           continuation_t  parent_cont,
                           void           *sub_app_frame,
                           inlet_t         return_inlet);

struct frame *sched_sync(struct frame *node,
                         continuation_t cont);

struct frame *sched_return(struct frame *node, size_t result);

size_t prun(size_t n_workers, continuation_t fun, void *arg);

typedef const char *magic_t;

#endif
