Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 52472 invoked by uid 500); 1 Aug 2001 15:03:12 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 52459 invoked from network); 1 Aug 2001 15:03:11 -0000 X-Authentication-Warning: hel.bp.aventail.com: wmperry set sender to wmperry@aventail.com using -f Sender: wmperry@aventail.com To: new-httpd@apache.org Subject: condition variables in APR... X-Now-Listening-To: Barry White - Theme from Shaft X-Face: O~Rn;(l][/-o1sALg4A@xpE:9-"'IR[%;,,!m7 Lines: 32 User-Agent: Gnus/5.090004 (Oort Gnus v0.04) XEmacs/21.5 (anise) MIME-Version: 1.0 X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Status: O X-Status: X-Keywords: X-UID: 12 My boss says it is ok to contribute the cross-platform condition variable code I wrote here. It is currently not very APR like though. It uses common macros defined in header files with common C code. I can rip out the implementation easily into unix & win32 files though. beos & mac will have to be done by someone else. I haven't programmed on a mac in close to a decade. :) Where is the best place to put this in APR? It doesn't seem to belong in apr/locks/ - does it deserve its own subdirectory in APR? For win32 this uses events: init -- pcond = CreateEvent(NULL,TRUE,TRUE,NULL); wait -- HANDLE h[2]; h[0] = pcond; h[1] = mutex; MUTEX_UNLOCK(mid); WaitForMultipleObjects(2,h,TRUE,INFINITE); signal -- SetEvent(pcond); broadcast -- ResetEvent(pcond); destroy -- CloseHandle(pcond); On unix of course we would just use the pthread_cond_xxx routines. The only sticky point I see is having some way to get the underlying system representation from an `apr_lock_t' to pass to WaitForMultipleObjects or pthread_cond_wait. Would it be sane to include locks.h and do the appropriate munging? Nobody outside of the locks/ directory seems to use it (other that misc/unix/start.c and that is just for a forward function declaration). -bp -- Ceterum censeo vi esse delendam