1#ifndef STP_H
2#define STP_H
3
4/*
5 * QuickThreads -- Threads-building toolkit.
6 * Copyright (c) 1993 by David Keppel
7 *
8 * Permission to use, copy, modify and distribute this software and
9 * its documentation for any purpose and without fee is hereby
10 * granted, provided that the above copyright notice and this notice
11 * appear in all copies.  This software is provided as a
12 * proof-of-concept and for demonstration purposes; there is no
13 * representation about the suitability of this software for any
14 * purpose.
15 */
16
17typedef struct stp_t stp_t;
18
19/* Each thread starts by calling a user-supplied function of this
20   type. */
21
22typedef void (stp_userf_t)(void *p0);
23
24/* Call this before any other primitives. */
25extern void stp_init();
26
27/* When one or more threads are created by the main thread,
28   the system goes multithread when this is called.  It is done
29   (no more runable threads) when this returns. */
30
31extern void stp_start (void);
32
33/* Create a thread and make it runable.  When the thread starts
34   running it will call `f' with arguments `p0' and `p1'. */
35
36extern void stp_create (stp_userf_t *f, void *p0);
37
38/* The current thread stops running but stays runable.
39   It is an error to call `stp_yield' before `stp_start'
40   is called or after `stp_start' returns. */
41
42extern void stp_yield (void);
43
44/* Like `stp_yield' but the thread is discarded.  Any intermediate
45   state is lost.  The thread can also terminate by simply
46   returning. */
47
48extern void stp_abort (void);
49
50
51#endif /* ndef STP_H */
52