Re: [AD] [UNIX] signals and threads

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


> 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:

--- include/allegro/platform/aintunix.h 2001/11/06 16:25:00 1.2
+++ include/allegro/platform/aintunix.h 2001/11/28 06:49:58
@@ -79,22 +79,24 @@
    AL_FUNC(void, _xwin_handle_input, (void));
 
 
-   #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)
 
-   #define XUNLOCK()    \
-      if (_unix_bg_man->multi_threaded) { \
-  if (_xwin.display) {   \
-     XUnlockDisplay(_xwin.display); \
-  }     \
-      } else {     \
-  _xwin.lock_count--;   \
-      }
+   #define XUNLOCK()                            \
+      do {                                      \
+         if (_unix_bg_man->multi_threaded) {    \
+            if (_xwin.display)                  \
+               XUnlockDisplay(_xwin.display);   \
+         }                                      \
+         _xwin.lock_count--;                    \
+      } while (0)
+
 #endif

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



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