DtSvcLock.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: DtSvcLock.h /main/6 1996/08/28 17:58:14 rswiston $ */
  24. /* *
  25. * (c) Copyright 1996 Hewlett-Packard Company *
  26. * (c) Copyright 1996 International Business Machines Corp. *
  27. * (c) Copyright 1996 Sun Microsystems, Inc. *
  28. * (c) Copyright 1996 Novell, Inc. *
  29. * (c) Copyright 1996 Digital Equipment Corporation. *
  30. * (c) Copyright 1996 FUJITSU LIMITED. *
  31. * (c) Copyright 1996 Hitachi. *
  32. */
  33. #ifndef _DtSvc_Lock_h
  34. #define _DtSvc_Lock_h
  35. /******** Conditionally defined macros for thread_safe DtSvc ******/
  36. #ifdef XTHREADS
  37. #define _DtSvcWidgetToAppContext(w) \
  38. XtAppContext app = XtWidgetToApplicationContext(w)
  39. #define _DtSvcDisplayToAppContext(d) \
  40. XtAppContext app = XtDisplayToApplicationContext(d)
  41. #define _DtSvcAppLock(app) XtAppLock(app)
  42. #define _DtSvcAppUnlock(app) XtAppUnlock(app)
  43. /*
  44. * NOTE: To use _DtSvcApp{Lock,Unlock}Default(), your file
  45. * must either include <Dt/DtP.h> or declare _DtAppContext
  46. * as an external variable, i.e. "extern XtAppContext _DtAppContext;"
  47. */
  48. #define _DtSvcAppLockDefault() \
  49. if (_DtAppContext != (XtAppContext)NULL) XtAppLock(_DtAppContext)
  50. #define _DtSvcAppUnlockDefault() \
  51. if (_DtAppContext != (XtAppContext)NULL) XtAppUnlock(_DtAppContext)
  52. #define _DtSvcProcessLock() XtProcessLock()
  53. #define _DtSvcProcessUnlock() XtProcessUnlock()
  54. #else /* XTHREADS */
  55. #define _DtSvcWidgetToAppContext(w)
  56. #define _DtSvcDisplayToAppContext(d)
  57. #define _DtSvcAppLock(app)
  58. #define _DtSvcAppUnlock(app)
  59. #define _DtSvcAppLockDefault()
  60. #define _DtSvcAppUnlockDefault()
  61. #define _DtSvcProcessLock()
  62. #define _DtSvcProcessUnlock()
  63. #endif /* XTHREADS */
  64. #endif /* _DtSvc_Lock_h */
  65. /* DON'T ADD ANYTHING AFTER THIS #endif... */