Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 11055 invoked by uid 500); 19 Jul 2002 17:48:34 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 11044 invoked from network); 19 Jul 2002 17:48:34 -0000 Date: 19 Jul 2002 17:48:33 -0000 Message-ID: <20020719174833.32866.qmail@icarus.apache.org> From: bnicholes@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/threadproc/netware thread.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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)