libtealet 0.4.2
Loading...
Searching...
No Matches
tealet_extras.h
Go to the documentation of this file.
1
5#include "tealet.h"
6#ifndef _TEALET_EXTRAS_H_
7#define _TEALET_EXTRAS_H_
8
9/****************************************************************
10 * A tealet allocator that gathers usage statistics
11 */
12
13typedef struct tealet_statsalloc_t {
14 tealet_alloc_t alloc;
15 tealet_alloc_t *base;
16 size_t n_allocs;
17 size_t s_allocs;
19
20TEALET_API
21void tealet_statsalloc_init(tealet_statsalloc_t *alloc, tealet_alloc_t *base);
22
23/****************************************************************
24 * A tealet stub mechanism.
25 * A stub is a special paused tealet, that can be restarted to
26 * run any function. It can also be duplicated, providing a
27 * convenient mechanism to start a family of tealets from a common
28 * position on the stack.
29 */
30
31/* create a stub and return it */
32TEALET_API
33tealet_t *tealet_stub_new(tealet_t *tealet, void *stack_far);
34
35/*
36 * Run a previously created stub.
37 * Behaviour is similar to tealet_new(), except that 'stub' must be the
38 * result of tealet_stub_new(), or the result
39 * of tealet_duplicate() on such a stub. Otherwise
40 * behaviour is undefined.
41 */
42TEALET_API
43int tealet_stub_run(tealet_t *stub, tealet_run_t run, void **parg);
44
45#endif /* _TEALET_EXTRAS_H_ */
Definition tealet.h:40
Definition tealet_extras.h:13
Definition tealet.h:61
Public core API for libtealet.
tealet_t *(* tealet_run_t)(tealet_t *current, void *arg)
Definition tealet.h:74