nanogui: Multi threads with WIN32 API


Previous by date: 21 Nov 2001 19:23:20 -0000 Re: Multi threads with WIN32 API, Peter Dufault
Next by date: 21 Nov 2001 19:23:20 -0000 Bug in GrMapWindow???, Olaf Winne
Previous in thread: 21 Nov 2001 19:23:20 -0000 Re: Multi threads with WIN32 API, Peter Dufault
Next in thread:

Subject: Re: [nanogui] Multi threads with WIN32 API
From: "Greg Haerr" ####@####.####
Date: 21 Nov 2001 19:23:20 -0000
Message-Id: <01ac01c172c1$caca6180$3aba46a6@xmission.com>

: #if HAVE_PTHREADS
: #include ...
: #define mutex_init(M, A) ...
: #define mutex_destroy(M) ...
: #define mutex_lock(M)   ...
: #define mutex_unlock(M)  ...
: #elif HAVE_XTHREADS
: #define mutex_init(M, A) ...
: #define mutex_destroy(M) ...
: #define mutex_lock(M)   ...
: #define mutex_unlock(M)  ...
: #else
: #define mutex_init(M, A) 
: #define mutex_destroy(M) 
: #define mutex_lock(M)   
: #define mutex_unlock(M)  
: #endif

: I like this because we don't have to define a new API.

I agree, we don't want another API, just a simple wrapper 
layer for Microwindows, managed by macros rather than
actual calls for a specific library.

That is, we wrap the pthread functions with
an identical (upper-case) #define, and don't use the
phrase "pthread" in the macro name, so that others that
run Microwindows on other environments don't think
they've got to have pthreads to get threading capabilities.
Also, by forcing a single define per threading library function
name use in a header file, a quick look by anybody can see
exactly which threading calls are used by which threading
library in Microwindows.

In other words, with the above macros, one can quickly
see that all that's required for threading implementation in
Microwindows is an init, destroy, lock and unlock call.
Ideally, the wrapper layer describes simple semantics of the
threading functionality required, rather than the actual
arguments required of pthreads.

In any case, have at it!

Regards,

Greg




Previous by date: 21 Nov 2001 19:23:20 -0000 Re: Multi threads with WIN32 API, Peter Dufault
Next by date: 21 Nov 2001 19:23:20 -0000 Bug in GrMapWindow???, Olaf Winne
Previous in thread: 21 Nov 2001 19:23:20 -0000 Re: Multi threads with WIN32 API, Peter Dufault
Next in thread:


Powered by ezmlm-browse 0.20.