summaryrefslogtreecommitdiff
path: root/threadproc/os2
diff options
context:
space:
mode:
authorBrian Havard <bjh@apache.org>2001-09-02 05:34:55 +0000
committerBrian Havard <bjh@apache.org>2001-09-02 05:34:55 +0000
commit90c293670d0ce55e0dbe1f1aae525742b6165014 (patch)
treee18226aa978bf9885dcadde36dd2410d3885c0ef /threadproc/os2
parente96b333ec195e65f00563bc930548fc9a14ba3de (diff)
downloadapr-90c293670d0ce55e0dbe1f1aae525742b6165014.tar.gz
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
Diffstat (limited to 'threadproc/os2')
-rw-r--r--threadproc/os2/thread.c14
1 files changed, 14 insertions, 0 deletions
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);
}