summaryrefslogtreecommitdiff
path: root/implement.h
diff options
context:
space:
mode:
authorrpj <rpj>1998-07-23 13:34:41 +0000
committerrpj <rpj>1998-07-23 13:34:41 +0000
commit5629d479c341f7bfaf89489b88f0fc701860ac6f (patch)
tree42c8f2719b617b8db2e6c611daf00db04304c757 /implement.h
parentf33f4460f9de9c2d2ae6f3bf05caed391c6ad485 (diff)
* global.c: New. Global data objects declared here. These moved from
pthread.h. * pthread.h: Move implementation hidden definitions into implement.h. * implement.h: Move implementation hidden definitions from pthread.h. Add constants to index into the different handler stacks. * cleanup.c (_pthread_handler_push): Simplify args. Restructure. (_pthread_handler_pop): Simplify args. Restructure. (_pthread_handler_pop_all): Simplify args. Restructure.
Diffstat (limited to 'implement.h')
-rw-r--r--implement.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/implement.h b/implement.h
index 2256965..e507831 100644
--- a/implement.h
+++ b/implement.h
@@ -27,6 +27,47 @@ enum { _PTHREAD_HANDLER_POP_LIFO, _PTHREAD_HANDLER_POP_FIFO };
*/
#define RND_SIZEOF(T) (((sizeof(T) / sizeof(DWORD)) + 1) * sizeof(DWORD))
+/* General description of a handler function on a stack. */
+typedef struct _pthread_handler_node _pthread_handler_node_t;
+
+struct _pthread_handler_node {
+ _pthread_handler_node_t next;
+ void (* routine)(void *);
+ void * arg;
+};
+
+/* Stores a thread call routine and argument. */
+typedef struct {
+ unsigned (*routine)(void *);
+ void * arg;
+} _pthread_call_t;
+
+#define _PTHREAD_THIS (_pthread_find_thread_entry(pthread_this()))
+
+#define _PTHREAD_STACK(stack) \
+ ((_pthread_handler_node_t *) &(_PTHREAD_THIS)->cleanupstack + stack);
+
+/* An element in the thread table. */
+typedef struct _pthread_threads_thread _pthread_threads_thread_t;
+
+struct _pthread_threads_thread {
+ pthread_t thread;
+ pthread_attr_t attr;
+ _pthread_call_t call;
+ enum {
+ _PTHREAD_CLEANUP_STACK,
+ _PTHREAD_DESTRUCTOR_STACK,
+ _PTHREAD_FORKPREPARE_STACK,
+ _PTHREAD_FORKPARENT_STACK,
+ _PTHREAD_FORKCHILD_STACK
+ };
+ _pthread_handler_node_t * cleanupstack;
+ _pthread_handler_node_t * destructorstack;
+ _pthread_handler_node_t * forkpreparestack;
+ _pthread_handler_node_t * forkparentstack;
+ _pthread_handler_node_t * forkchildstack;
+};
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */