Re: multithreaded callbacks (was Re: [AD] de fourium pointium ohium)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 03 Aug 2001, Eric Botcazou <ebotcazou@xxxxxxxxxx> wrote:
> 
> Should we use the pairs create_mutex()/destroy_mutex() and
> acquire_mutex()/release_mutex() or something more neutral ?

"MUTual EXclusion" seems pretty neutral to me.

> (The Windows port won't likely use Win32 mutexes but a more lightweight
> inner-process mechanism dubbed "critical sections"). 

But they can be used to do the same job, right?

Btw, the BeOS version would use semaphores.

> Moreover there is the namespace factor.

True.  Since they wouldn't be used a *lot*, maybe in `allegro.h':

void *allegro_create_mutex(void);
void allegro_destroy_mutex(void *);
	...

#ifdef ALLEGRO_MUTEXES

   #define create_mutex()      (allegro_create_mutex)()
   #define destroy_mutex(mtx)  (allegro_destroy_mutex)(mtx)
	...

#endif


#defin'ing ALLEGRO_MUTEXES (or whatever) is the users' responsibility.


If we employ this idea, I'd like to do something similar for
`clear', which collides with curses.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/