Re: [AD] [UNIX] signals and threads

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


On 2001-11-30, Eric Botcazou <ebotcazou@xxxxxxxxxx> wrote:
> > Please test and commit.
> 
> It works nicely for me, both under X11 and in a console.
> But there is something a little surprising in this patch:
...
> -   #define XLOCK()    \
> -      if (_unix_bg_man->multi_threaded) { \
> -  if (_xwin.display)   \
> -     XLockDisplay(_xwin.display); \
> -      } else {     \
> -  _xwin.lock_count++;   \
> -      }
> +   #define XLOCK()                              \
> +      do {                                      \
> +         if (_unix_bg_man->multi_threaded) {    \
> +            if (_xwin.display)                  \
> +               XLockDisplay(_xwin.display);     \
> +         }                                      \
> +         _xwin.lock_count++;                    \
> +      } while (0)

I'm using _xwin.lock_count to remember if we are in a "locked" state
or not, regardless of the truth of _unix_bg_man->multi_threaded.  Is
that what's surprising?  Or the do/while? 



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