Re: [AD] Mini-synchronization API proposal for 4.1.x |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On March 24, 2002 07:36 pm, you wrote:
> 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).
My thoughts exactly. I orriginally was going to say something about WE HAVE
TO WAIT... But then I remembered you cant in a call back... Will we have to
pause any and all timers when a mutex is locked? Of course thats not really
acceptable. what can be done?
--
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx
http://strangesoft.net