From e5d956dbac4c3ef2c71f8a0a0080a7840032798a Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Sun, 5 Dec 1999 16:21:37 +0000 Subject: [PATCH] Add ts_allocate_dtor, use ts_allocate_[cd]tor where appropiate. --- TSRM/TSRM.c | 10 +++++----- TSRM/TSRM.h | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index f483527b38..4e97a61314 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -34,8 +34,8 @@ struct _tsrm_tls_entry { typedef struct { size_t size; - void (*ctor)(void *resource); - void (*dtor)(void *resource); + ts_allocate_ctor ctor; + ts_allocate_dtor dtor; } tsrm_resource_type; @@ -89,7 +89,7 @@ TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debu /* Shutdown TSRM (call once for the entire process) */ -TSRM_API void tsrm_shutdown() +TSRM_API void tsrm_shutdown(void) { int i; @@ -120,7 +120,7 @@ TSRM_API void tsrm_shutdown() /* allocates a new thread-safe-resource id */ -TSRM_API ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource)) +TSRM_API ts_rsrc_id ts_allocate_id(size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor) { ts_rsrc_id new_id; int i; @@ -245,7 +245,7 @@ void *ts_resource(ts_rsrc_id id) /* frees all resources allocated for the current thread */ -void ts_free_thread() +void ts_free_thread(void) { THREAD_T thread_id = tsrm_thread_id(); int hash_value; diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h index 10554a9a55..a86f21c089 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -60,6 +60,7 @@ typedef int ts_rsrc_id; #endif typedef void (*ts_allocate_ctor)(void *); +typedef void (*ts_allocate_dtor)(void *); #define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts @@ -69,16 +70,16 @@ extern "C" { /* startup/shutdown */ TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_status); -TSRM_API void tsrm_shutdown(); +TSRM_API void tsrm_shutdown(void); /* allocates a new thread-safe-resource id */ -TSRM_API ts_rsrc_id ts_allocate_id(size_t size, ts_allocate_ctor ctor, void (*dtor)(void *resource)); +TSRM_API ts_rsrc_id ts_allocate_id(size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor); /* fetches the requested resource for the current thread */ TSRM_API void *ts_resource(ts_rsrc_id id); /* frees all resources allocated for the current thread */ -TSRM_API void ts_free_thread(); +TSRM_API void ts_free_thread(void); /* deallocates all occurrences of a given id */ TSRM_API void ts_free_id(ts_rsrc_id id); -- 2.40.0