ThreadsI.h revision 1477040f
1444c061aSmrg/* $Xorg: ThreadsI.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ 2444c061aSmrg 3444c061aSmrg/************************************************************ 4444c061aSmrg 51477040fSmrgCopyright 1993 Sun Microsystems, Inc. All rights reserved. 6444c061aSmrg 71477040fSmrgPermission is hereby granted, free of charge, to any person obtaining a 81477040fSmrgcopy of this software and associated documentation files (the "Software"), 91477040fSmrgto deal in the Software without restriction, including without limitation 101477040fSmrgthe rights to use, copy, modify, merge, publish, distribute, sublicense, 111477040fSmrgand/or sell copies of the Software, and to permit persons to whom the 121477040fSmrgSoftware is furnished to do so, subject to the following conditions: 13444c061aSmrg 141477040fSmrgThe above copyright notice and this permission notice (including the next 151477040fSmrgparagraph) shall be included in all copies or substantial portions of the 161477040fSmrgSoftware. 171477040fSmrg 181477040fSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 191477040fSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 201477040fSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 211477040fSmrgTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 221477040fSmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 231477040fSmrgFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 241477040fSmrgDEALINGS IN THE SOFTWARE. 25444c061aSmrg 26444c061aSmrg********************************************************/ 27444c061aSmrg 28444c061aSmrg/* 29444c061aSmrg 30444c061aSmrgCopyright 1994, 1998 The Open Group 31444c061aSmrg 32444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its 33444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that 34444c061aSmrgthe above copyright notice appear in all copies and that both that 35444c061aSmrgcopyright notice and this permission notice appear in supporting 36444c061aSmrgdocumentation. 37444c061aSmrg 38444c061aSmrgThe above copyright notice and this permission notice shall be included in 39444c061aSmrgall copies or substantial portions of the Software. 40444c061aSmrg 41444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 45444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 46444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 47444c061aSmrg 48444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be 49444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings 50444c061aSmrgin this Software without prior written authorization from The Open Group. 51444c061aSmrg 52444c061aSmrg*/ 53444c061aSmrg/* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */ 54444c061aSmrg 55444c061aSmrg#ifndef _XtThreadsI_h 56444c061aSmrg#define _XtThreadsI_h 57444c061aSmrg 58444c061aSmrg#include <X11/XlibConf.h> 59444c061aSmrg 60444c061aSmrg#ifdef XTHREADS 61444c061aSmrg 62444c061aSmrgtypedef struct _LockRec *LockPtr; 63444c061aSmrg 64444c061aSmrgtypedef void (*ThreadAppProc)( 65444c061aSmrg XtAppContext /* app */ 66444c061aSmrg); 67444c061aSmrg 68444c061aSmrgtypedef void (*ThreadAppYieldLockProc)( 69444c061aSmrg XtAppContext, /* app */ 70444c061aSmrg Boolean*, /* push_thread */ 71444c061aSmrg Boolean*, /* pushed_thread */ 72444c061aSmrg int* /* level */ 73444c061aSmrg); 74444c061aSmrg 75444c061aSmrgtypedef void (*ThreadAppRestoreLockProc)( 76444c061aSmrg XtAppContext /* app */, 77444c061aSmrg int, /* level */ 78444c061aSmrg Boolean* /* pushed_thread */ 79444c061aSmrg); 80444c061aSmrg 812265a131Smrg_XFUNCPROTOBEGIN 822265a131Smrg 83444c061aSmrgextern void (*_XtProcessLock)( 84444c061aSmrg void 85444c061aSmrg); 86444c061aSmrg 87444c061aSmrgextern void (*_XtProcessUnlock)( 88444c061aSmrg void 89444c061aSmrg); 90444c061aSmrg 91444c061aSmrgextern void (*_XtInitAppLock)( 92444c061aSmrg XtAppContext /* app */ 93444c061aSmrg); 94444c061aSmrg 952265a131Smrg_XFUNCPROTOEND 962265a131Smrg 97444c061aSmrg#define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app) 98444c061aSmrg#define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app) 99444c061aSmrg 100444c061aSmrg#define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)() 101444c061aSmrg#define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)() 102444c061aSmrg#define LOCK_APP(app) if(app && app->lock)(*app->lock)(app) 103444c061aSmrg#define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app) 104444c061aSmrg 105444c061aSmrg#define YIELD_APP_LOCK(app,push,pushed,level)\ 106444c061aSmrg if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level) 107444c061aSmrg#define RESTORE_APP_LOCK(app,level,pushed)\ 108444c061aSmrg if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed) 109444c061aSmrg 110444c061aSmrg#define WIDGET_TO_APPCON(w) \ 111444c061aSmrg XtAppContext app = (w && _XtProcessLock ? \ 112444c061aSmrg XtWidgetToApplicationContext(w) : NULL) 113444c061aSmrg 114444c061aSmrg#define DPY_TO_APPCON(d) \ 1152265a131Smrg XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): NULL) 116444c061aSmrg 117444c061aSmrg#else /* defined(XTHREADS) */ 118444c061aSmrg 119444c061aSmrg#define LOCK_PROCESS 120444c061aSmrg#define UNLOCK_PROCESS 121444c061aSmrg#define LOCK_APP(app) 122444c061aSmrg#define UNLOCK_APP(app) 123444c061aSmrg 124444c061aSmrg#define INIT_APP_LOCK(app) 125444c061aSmrg#define FREE_APP_LOCK(app) 126444c061aSmrg 127444c061aSmrg#define WIDGET_TO_APPCON(w) 128444c061aSmrg#define DPY_TO_APPCON(d) 129444c061aSmrg 130444c061aSmrg#endif /* !defined(XTHREADS) */ 131444c061aSmrg#endif /* _XtThreadsI_h */ 132