stp.h

Go to the documentation of this file.
00001 #ifndef STP_H
00002 #define STP_H
00003 
00004 /*
00005  * QuickThreads -- Threads-building toolkit.
00006  * Copyright (c) 1993 by David Keppel
00007  *
00008  * Permission to use, copy, modify and distribute this software and
00009  * its documentation for any purpose and without fee is hereby
00010  * granted, provided that the above copyright notice and this notice
00011  * appear in all copies.  This software is provided as a
00012  * proof-of-concept and for demonstration purposes; there is no
00013  * representation about the suitability of this software for any
00014  * purpose.
00015  */
00016 
00017 typedef struct stp_t stp_t;
00018 
00019 /* Each thread starts by calling a user-supplied function of this
00020    type. */
00021 
00022 typedef void (stp_userf_t)(void *p0);
00023 
00024 /* Call this before any other primitives. */
00025 extern void stp_init();
00026 
00027 /* When one or more threads are created by the main thread,
00028    the system goes multithread when this is called.  It is done
00029    (no more runable threads) when this returns. */
00030 
00031 extern void stp_start (void);
00032 
00033 /* Create a thread and make it runable.  When the thread starts
00034    running it will call `f' with arguments `p0' and `p1'. */
00035 
00036 extern void stp_create (stp_userf_t *f, void *p0);
00037 
00038 /* The current thread stops running but stays runable.
00039    It is an error to call `stp_yield' before `stp_start'
00040    is called or after `stp_start' returns. */
00041 
00042 extern void stp_yield (void);
00043 
00044 /* Like `stp_yield' but the thread is discarded.  Any intermediate
00045    state is lost.  The thread can also terminate by simply
00046    returning. */
00047 
00048 extern void stp_abort (void);
00049 
00050 
00051 #endif /* ndef STP_H */

Generated on Wed Jan 21 15:32:10 2009 for SystemC by  doxygen 1.5.5