Home | History | Annotate | Line # | Download | only in X11
      1 /************************************************************
      2 
      3 Copyright (c) 1993, Oracle and/or its affiliates.
      4 
      5 Permission is hereby granted, free of charge, to any person obtaining a
      6 copy of this software and associated documentation files (the "Software"),
      7 to deal in the Software without restriction, including without limitation
      8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
      9 and/or sell copies of the Software, and to permit persons to whom the
     10 Software is furnished to do so, subject to the following conditions:
     11 
     12 The above copyright notice and this permission notice (including the next
     13 paragraph) shall be included in all copies or substantial portions of the
     14 Software.
     15 
     16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     22 DEALINGS IN THE SOFTWARE.
     23 
     24 ********************************************************/
     25 
     26 /*
     27 
     28 Copyright 1994, 1998  The Open Group
     29 
     30 Permission to use, copy, modify, distribute, and sell this software and its
     31 documentation for any purpose is hereby granted without fee, provided that
     32 the above copyright notice appear in all copies and that both that
     33 copyright notice and this permission notice appear in supporting
     34 documentation.
     35 
     36 The above copyright notice and this permission notice shall be included in
     37 all copies or substantial portions of the Software.
     38 
     39 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     40 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     41 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     42 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     43 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     44 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     45 
     46 Except as contained in this notice, the name of The Open Group shall not be
     47 used in advertising or otherwise to promote the sale, use or other dealings
     48 in this Software without prior written authorization from The Open Group.
     49 
     50 */
     51 /* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */
     52 
     53 #ifndef _XtThreadsI_h
     54 #define _XtThreadsI_h
     55 
     56 #include <X11/XlibConf.h>
     57 
     58 #ifdef XTHREADS
     59 
     60 typedef struct _LockRec *LockPtr;
     61 
     62 typedef void (*ThreadAppProc)(
     63     XtAppContext /* app */
     64 );
     65 
     66 typedef void (*ThreadAppYieldLockProc)(
     67     XtAppContext, /* app */
     68     Boolean*, /* push_thread */
     69     Boolean*, /* pushed_thread */
     70     int* /* level */
     71 );
     72 
     73 typedef void (*ThreadAppRestoreLockProc)(
     74     XtAppContext /* app */,
     75     int, /* level */
     76     Boolean* /* pushed_thread */
     77 );
     78 
     79 _XFUNCPROTOBEGIN
     80 
     81 extern void (*_XtProcessLock)(
     82     void
     83 );
     84 
     85 extern void (*_XtProcessUnlock)(
     86     void
     87 );
     88 
     89 extern void (*_XtInitAppLock)(
     90     XtAppContext /* app */
     91 );
     92 
     93 _XFUNCPROTOEND
     94 
     95 #define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app)
     96 #define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app)
     97 
     98 #define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)()
     99 #define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)()
    100 #define LOCK_APP(app) if(app && app->lock)(*app->lock)(app)
    101 #define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app)
    102 
    103 #define YIELD_APP_LOCK(app,push,pushed,level)\
    104 	 if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level)
    105 #define RESTORE_APP_LOCK(app,level,pushed)\
    106 	 if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed)
    107 
    108 #define WIDGET_TO_APPCON(w) \
    109     XtAppContext app = (w && _XtProcessLock ? \
    110 	XtWidgetToApplicationContext(w) : NULL)
    111 
    112 #define DPY_TO_APPCON(d) \
    113     XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): NULL)
    114 
    115 #else /* defined(XTHREADS) */
    116 
    117 #define LOCK_PROCESS
    118 #define UNLOCK_PROCESS
    119 #define LOCK_APP(app)
    120 #define UNLOCK_APP(app)
    121 
    122 #define INIT_APP_LOCK(app)
    123 #define FREE_APP_LOCK(app)
    124 
    125 #define WIDGET_TO_APPCON(w)
    126 #define DPY_TO_APPCON(d)
    127 
    128 #endif /* !defined(XTHREADS) */
    129 #endif /* _XtThreadsI_h */
    130