[AD] replace xlock/xunlock with synchronized{}

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


Would anyone be opposed to replacing all the XLOCK()/XUNLOCK() blocks in the x11 code of Allegro with a #define'd syntax that does the same thing, with preferably the same name as java's sychnronization keyword 'synchronized' ?

Basically do this

#define synchronized for ( XLOCK(); XUNLOCK(); /**/ )

and then instead of

int _xwin_create_window(void)
{
  int result;
  XLOCK();
  result = (*_xwin_window_creator)();
  XUNLOCK();
  return result;
}

would be

int _xwin_create_window(void)
{
  int result;
  synchronized{
      result = (*_xwin_window_creator)();
   }
  return result;
}

Yes I use Java a lot these days and I find this very clean. Plus it would prevent the mistake of forgetting to use XUNLOCK() occasionally.







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