From 90c293670d0ce55e0dbe1f1aae525742b6165014 Mon Sep 17 00:00:00 2001 From: Brian Havard Date: Sun, 2 Sep 2001 05:34:55 +0000 Subject: Clean up the event sem in the apr_thread_once_t. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@62281 13f79535-47bb-0310-9956-ffa450edef68 --- threadproc/os2/thread.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'threadproc/os2') diff --git a/threadproc/os2/thread.c b/threadproc/os2/thread.c index f65a9f1a4..70da428cb 100644 --- a/threadproc/os2/thread.c +++ b/threadproc/os2/thread.c @@ -242,12 +242,26 @@ APR_POOL_IMPLEMENT_ACCESSOR_X(thread, cntxt) +static apr_status_t thread_once_cleanup(void *vcontrol) +{ + apr_thread_once_t *control = (apr_thread_once_t *)vcontrol; + + if (control->sem) { + DosCloseEventSem(control->sem); + } + + return APR_SUCCESS; +} + + + APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, apr_pool_t *p) { ULONG rc; *control = (apr_thread_once_t *)apr_pcalloc(p, sizeof(apr_thread_once_t)); rc = DosCreateEventSem(NULL, &(*control)->sem, 0, TRUE); + apr_pool_cleanup_register(p, control, thread_once_cleanup, apr_pool_cleanup_null); return APR_FROM_OS_ERROR(rc); } -- cgit v1.2.1