ThreadsI.h revision 444c061a
1/* $Xorg: ThreadsI.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */ 2 3/************************************************************ 4Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA. 5 6 All Rights Reserved 7 8Permission to use, copy, modify, and distribute this 9software and its documentation for any purpose and without 10fee is hereby granted, provided that the above copyright no- 11tice appear in all copies and that both that copyright no- 12tice and this permission notice appear in supporting docu- 13mentation, and that the name Sun not be used in advertising 14or publicity pertaining to distribution of the software 15without specific prior written permission. Sun makes no 16representations about the suitability of this software for 17any purpose. It is provided "as is" without any express or 18implied warranty. 19 20SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 21INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- 22NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- 23ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 24ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 25PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 26OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH 27THE USE OR PERFORMANCE OF THIS SOFTWARE. 28 29********************************************************/ 30 31/* 32 33Copyright 1994, 1998 The Open Group 34 35Permission to use, copy, modify, distribute, and sell this software and its 36documentation for any purpose is hereby granted without fee, provided that 37the above copyright notice appear in all copies and that both that 38copyright notice and this permission notice appear in supporting 39documentation. 40 41The above copyright notice and this permission notice shall be included in 42all copies or substantial portions of the Software. 43 44THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 45IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 46FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 47OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 48AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 49CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 50 51Except as contained in this notice, the name of The Open Group shall not be 52used in advertising or otherwise to promote the sale, use or other dealings 53in this Software without prior written authorization from The Open Group. 54 55*/ 56/* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */ 57 58#ifndef _XtThreadsI_h 59#define _XtThreadsI_h 60 61#include <X11/XlibConf.h> 62 63#ifdef XTHREADS 64 65typedef struct _LockRec *LockPtr; 66 67typedef void (*ThreadAppProc)( 68 XtAppContext /* app */ 69); 70 71typedef void (*ThreadAppYieldLockProc)( 72 XtAppContext, /* app */ 73 Boolean*, /* push_thread */ 74 Boolean*, /* pushed_thread */ 75 int* /* level */ 76); 77 78typedef void (*ThreadAppRestoreLockProc)( 79 XtAppContext /* app */, 80 int, /* level */ 81 Boolean* /* pushed_thread */ 82); 83 84extern void (*_XtProcessLock)( 85 void 86); 87 88extern void (*_XtProcessUnlock)( 89 void 90); 91 92extern void (*_XtInitAppLock)( 93 XtAppContext /* app */ 94); 95 96#define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app) 97#define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app) 98 99#define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)() 100#define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)() 101#define LOCK_APP(app) if(app && app->lock)(*app->lock)(app) 102#define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app) 103 104#define YIELD_APP_LOCK(app,push,pushed,level)\ 105 if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level) 106#define RESTORE_APP_LOCK(app,level,pushed)\ 107 if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed) 108 109#define WIDGET_TO_APPCON(w) \ 110 XtAppContext app = (w && _XtProcessLock ? \ 111 XtWidgetToApplicationContext(w) : NULL) 112 113#define DPY_TO_APPCON(d) \ 114 XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): 0) 115 116#else /* defined(XTHREADS) */ 117 118#define LOCK_PROCESS 119#define UNLOCK_PROCESS 120#define LOCK_APP(app) 121#define UNLOCK_APP(app) 122 123#define INIT_APP_LOCK(app) 124#define FREE_APP_LOCK(app) 125 126#define WIDGET_TO_APPCON(w) 127#define DPY_TO_APPCON(d) 128 129#endif /* !defined(XTHREADS) */ 130#endif /* _XtThreadsI_h */ 131