bnicholes 2002/07/19 10:48:33
Modified: include/arch/netware threadproc.h
threadproc/netware thread.c
Log:
Implemented the thread_once API's on NetWare
Revision Changes Path
1.8 +4 -0 apr/include/arch/netware/threadproc.h
Index: threadproc.h
===================================================================
RCS file: /home/cvs/apr/include/arch/netware/threadproc.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- threadproc.h 8 Jul 2002 17:34:54 -0000 1.7
+++ threadproc.h 19 Jul 2002 17:48:33 -0000 1.8
@@ -100,6 +100,10 @@
apr_int32_t detached;
};
+struct apr_thread_once_t {
+ unsigned long value;
+};
+
//struct apr_proc_t {
// apr_pool_t *pool;
// pid_t pid;
1.12 +6 -2 apr/threadproc/netware/thread.c
Index: thread.c
===================================================================
RCS file: /home/cvs/apr/threadproc/netware/thread.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- thread.c 19 Mar 2002 17:53:59 -0000 1.11
+++ thread.c 19 Jul 2002 17:48:33 -0000 1.12
@@ -263,13 +263,17 @@
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
apr_pool_t *p)
{
- return APR_ENOTIMPL;
+ (*control) = apr_pcalloc(p, sizeof(**control));
+ return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
void (*func)(void))
{
- return APR_ENOTIMPL;
+ if (!atomic_xchg(&control->value, 1)) {
+ func();
+ }
+ return APR_SUCCESS;
}
APR_POOL_IMPLEMENT_ACCESSOR(thread)