From 492c73cf1f1b3e35b394aec991d1201726ec606d Mon Sep 17 00:00:00 2001 From: rpj Date: Tue, 21 Jul 1998 17:04:38 +0000 Subject: Wed Jul 22 00:16:22 1998 Ross Johnson * cleanup.c (_pthread_cleanup_push): Implement. (_pthread_cleanup_pop): Implement. (_pthread_do_cancellation): Implement. These are private to the implementation. The real cleanup functions are macros. See below. * pthread.h (pthread_cleanup_push): Implement as a macro. (pthread_cleanup_pop): Implement as a macro. Because these are macros which start and end a block, the POSIX scoping requirement is observed. See the comment in the file. * exit.c (pthread_exit): Refine the code. * create.c (pthread_create): Code cleanup. * implement.h (RND_SIZEOF): Add RND_SIZEOF(T) to round sizeof(T) up to multiple of DWORD. Add function prototypes. * private.c (_pthread_getthreadindex): "*thread" should have been "thread". Detect empty slot fail condition. --- implement.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'implement.h') diff --git a/implement.h b/implement.h index 2e03c48..2a7e192 100644 --- a/implement.h +++ b/implement.h @@ -14,6 +14,10 @@ #define _PTHREAD_HASH_INDEX(x) (((ULONG) x) % PTHREAD_THREADS_MAX) +/* This is all compile time arithmetic */ +#define RND_SIZEOF(T) (((sizeof(T) / sizeof(DWORD)) + 1) * sizeof(DWORD)) + + typedef struct _pthread_cleanup_stack _pthread_cleanup_stack_t; struct _pthread_cleanup_stck { _pthread_cleanup_stack_t first; @@ -39,6 +43,18 @@ typedef struct { /* Nothing needed yet. */ } _pthread_condattr_t; +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +void _pthread_cleanup_push(void (*routine)(void *), void *arg); +void _pthread_cleanup_pop(int execute); +void _pthread_do_cancellation(int tindex); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* _IMPLEMENT_H */ -- cgit v1.2.3