diff options
author | Sascha Schumann <sas@php.net> | 1999-12-05 16:21:37 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 1999-12-05 16:21:37 +0000 |
commit | e5d956dbac4c3ef2c71f8a0a0080a7840032798a (patch) | |
tree | 9d735b81086dd8dcf314995f2f05490fcc69a080 | |
parent | 45f9527518bf95027a0e2989df5b51fd9efa4df5 (diff) | |
download | php-git-e5d956dbac4c3ef2c71f8a0a0080a7840032798a.tar.gz |
Add ts_allocate_dtor, use ts_allocate_[cd]tor where appropiate.
-rw-r--r-- | TSRM/TSRM.c | 10 | ||||
-rw-r--r-- | 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); |