112027Sjungma@eit.uni-kl.de#ifndef STP_H 212027Sjungma@eit.uni-kl.de#define STP_H 312027Sjungma@eit.uni-kl.de 412027Sjungma@eit.uni-kl.de/* 512027Sjungma@eit.uni-kl.de * QuickThreads -- Threads-building toolkit. 612027Sjungma@eit.uni-kl.de * Copyright (c) 1993 by David Keppel 712027Sjungma@eit.uni-kl.de * 812027Sjungma@eit.uni-kl.de * Permission to use, copy, modify and distribute this software and 912027Sjungma@eit.uni-kl.de * its documentation for any purpose and without fee is hereby 1012027Sjungma@eit.uni-kl.de * granted, provided that the above copyright notice and this notice 1112027Sjungma@eit.uni-kl.de * appear in all copies. This software is provided as a 1212027Sjungma@eit.uni-kl.de * proof-of-concept and for demonstration purposes; there is no 1312027Sjungma@eit.uni-kl.de * representation about the suitability of this software for any 1412027Sjungma@eit.uni-kl.de * purpose. 1512027Sjungma@eit.uni-kl.de */ 1612027Sjungma@eit.uni-kl.de 1712027Sjungma@eit.uni-kl.detypedef struct stp_t stp_t; 1812027Sjungma@eit.uni-kl.de 1912027Sjungma@eit.uni-kl.de/* Each thread starts by calling a user-supplied function of this 2012027Sjungma@eit.uni-kl.de type. */ 2112027Sjungma@eit.uni-kl.de 2212027Sjungma@eit.uni-kl.detypedef void (stp_userf_t)(void *p0); 2312027Sjungma@eit.uni-kl.de 2412027Sjungma@eit.uni-kl.de/* Call this before any other primitives. */ 2512027Sjungma@eit.uni-kl.deextern void stp_init(); 2612027Sjungma@eit.uni-kl.de 2712027Sjungma@eit.uni-kl.de/* When one or more threads are created by the main thread, 2812027Sjungma@eit.uni-kl.de the system goes multithread when this is called. It is done 2912027Sjungma@eit.uni-kl.de (no more runable threads) when this returns. */ 3012027Sjungma@eit.uni-kl.de 3112027Sjungma@eit.uni-kl.deextern void stp_start (void); 3212027Sjungma@eit.uni-kl.de 3312027Sjungma@eit.uni-kl.de/* Create a thread and make it runable. When the thread starts 3412027Sjungma@eit.uni-kl.de running it will call `f' with arguments `p0' and `p1'. */ 3512027Sjungma@eit.uni-kl.de 3612027Sjungma@eit.uni-kl.deextern void stp_create (stp_userf_t *f, void *p0); 3712027Sjungma@eit.uni-kl.de 3812027Sjungma@eit.uni-kl.de/* The current thread stops running but stays runable. 3912027Sjungma@eit.uni-kl.de It is an error to call `stp_yield' before `stp_start' 4012027Sjungma@eit.uni-kl.de is called or after `stp_start' returns. */ 4112027Sjungma@eit.uni-kl.de 4212027Sjungma@eit.uni-kl.deextern void stp_yield (void); 4312027Sjungma@eit.uni-kl.de 4412027Sjungma@eit.uni-kl.de/* Like `stp_yield' but the thread is discarded. Any intermediate 4512027Sjungma@eit.uni-kl.de state is lost. The thread can also terminate by simply 4612027Sjungma@eit.uni-kl.de returning. */ 4712027Sjungma@eit.uni-kl.de 4812027Sjungma@eit.uni-kl.deextern void stp_abort (void); 4912027Sjungma@eit.uni-kl.de 5012027Sjungma@eit.uni-kl.de 5112027Sjungma@eit.uni-kl.de#endif /* ndef STP_H */ 52