Re: [AD] Mini-synchronization API proposal for 4.1.x

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


On 2002-03-24, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> 
> void handler(void)
> {
>   al_mutex_lock(my_mutex);
>   my_value = 0;
>   al_mutex_unlock(my_mutex);
> }
> 
> int main()
> {
>   al_mutex_lock(my_mutex);
>   /* handler called here */
>   if(my_value) do something;
>   al_mutex_unlock(my_mutex);
> 
>   ...
> }
> 
> 
> if mutexes do nothing then wouldn't that be a bit odd? how would that be 
> handled? (can't wait in the handler...)

Ouch, this is Very Bad.  On one hand if AL_MUTEXes do something in the
pause-main-thread-for-callbacks case, then your program will deadlock.
OTOH if they do nothing, then they don't do what you want (some values
remaining constant between lock/unlock).



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