ThreadsI.h revision 2265a131
1444c061aSmrg/* $Xorg: ThreadsI.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */
2444c061aSmrg
3444c061aSmrg/************************************************************
4444c061aSmrgCopyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
5444c061aSmrg
6444c061aSmrg                    All Rights Reserved
7444c061aSmrg
8444c061aSmrgPermission  to  use,  copy,  modify,  and  distribute   this
9444c061aSmrgsoftware  and  its documentation for any purpose and without
10444c061aSmrgfee is hereby granted, provided that the above copyright no-
11444c061aSmrgtice  appear  in all copies and that both that copyright no-
12444c061aSmrgtice and this permission notice appear in  supporting  docu-
13444c061aSmrgmentation,  and  that the name Sun not be used in advertising
14444c061aSmrgor publicity pertaining to distribution  of  the software
15444c061aSmrgwithout specific prior written permission. Sun makes no
16444c061aSmrgrepresentations about the suitability of this software for
17444c061aSmrgany purpose. It is provided "as is" without any express or
18444c061aSmrgimplied warranty.
19444c061aSmrg
20444c061aSmrgSUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
21444c061aSmrgINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
22444c061aSmrgNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
23444c061aSmrgABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
24444c061aSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
25444c061aSmrgPROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
26444c061aSmrgOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
27444c061aSmrgTHE USE OR PERFORMANCE OF THIS SOFTWARE.
28444c061aSmrg
29444c061aSmrg********************************************************/
30444c061aSmrg
31444c061aSmrg/*
32444c061aSmrg
33444c061aSmrgCopyright 1994, 1998  The Open Group
34444c061aSmrg
35444c061aSmrgPermission to use, copy, modify, distribute, and sell this software and its
36444c061aSmrgdocumentation for any purpose is hereby granted without fee, provided that
37444c061aSmrgthe above copyright notice appear in all copies and that both that
38444c061aSmrgcopyright notice and this permission notice appear in supporting
39444c061aSmrgdocumentation.
40444c061aSmrg
41444c061aSmrgThe above copyright notice and this permission notice shall be included in
42444c061aSmrgall copies or substantial portions of the Software.
43444c061aSmrg
44444c061aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45444c061aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46444c061aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
47444c061aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
48444c061aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
49444c061aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50444c061aSmrg
51444c061aSmrgExcept as contained in this notice, the name of The Open Group shall not be
52444c061aSmrgused in advertising or otherwise to promote the sale, use or other dealings
53444c061aSmrgin this Software without prior written authorization from The Open Group.
54444c061aSmrg
55444c061aSmrg*/
56444c061aSmrg/* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */
57444c061aSmrg
58444c061aSmrg#ifndef _XtThreadsI_h
59444c061aSmrg#define _XtThreadsI_h
60444c061aSmrg
61444c061aSmrg#include <X11/XlibConf.h>
62444c061aSmrg
63444c061aSmrg#ifdef XTHREADS
64444c061aSmrg
65444c061aSmrgtypedef struct _LockRec *LockPtr;
66444c061aSmrg
67444c061aSmrgtypedef void (*ThreadAppProc)(
68444c061aSmrg    XtAppContext /* app */
69444c061aSmrg);
70444c061aSmrg
71444c061aSmrgtypedef void (*ThreadAppYieldLockProc)(
72444c061aSmrg    XtAppContext, /* app */
73444c061aSmrg    Boolean*, /* push_thread */
74444c061aSmrg    Boolean*, /* pushed_thread */
75444c061aSmrg    int* /* level */
76444c061aSmrg);
77444c061aSmrg
78444c061aSmrgtypedef void (*ThreadAppRestoreLockProc)(
79444c061aSmrg    XtAppContext /* app */,
80444c061aSmrg    int, /* level */
81444c061aSmrg    Boolean* /* pushed_thread */
82444c061aSmrg);
83444c061aSmrg
842265a131Smrg_XFUNCPROTOBEGIN
852265a131Smrg
86444c061aSmrgextern void (*_XtProcessLock)(
87444c061aSmrg    void
88444c061aSmrg);
89444c061aSmrg
90444c061aSmrgextern void (*_XtProcessUnlock)(
91444c061aSmrg    void
92444c061aSmrg);
93444c061aSmrg
94444c061aSmrgextern void (*_XtInitAppLock)(
95444c061aSmrg    XtAppContext /* app */
96444c061aSmrg);
97444c061aSmrg
982265a131Smrg_XFUNCPROTOEND
992265a131Smrg
100444c061aSmrg#define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app)
101444c061aSmrg#define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app)
102444c061aSmrg
103444c061aSmrg#define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)()
104444c061aSmrg#define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)()
105444c061aSmrg#define LOCK_APP(app) if(app && app->lock)(*app->lock)(app)
106444c061aSmrg#define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app)
107444c061aSmrg
108444c061aSmrg#define YIELD_APP_LOCK(app,push,pushed,level)\
109444c061aSmrg	 if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level)
110444c061aSmrg#define RESTORE_APP_LOCK(app,level,pushed)\
111444c061aSmrg	 if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed)
112444c061aSmrg
113444c061aSmrg#define WIDGET_TO_APPCON(w) \
114444c061aSmrg    XtAppContext app = (w && _XtProcessLock ? \
115444c061aSmrg	XtWidgetToApplicationContext(w) : NULL)
116444c061aSmrg
117444c061aSmrg#define DPY_TO_APPCON(d) \
1182265a131Smrg    XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): NULL)
119444c061aSmrg
120444c061aSmrg#else /* defined(XTHREADS) */
121444c061aSmrg
122444c061aSmrg#define LOCK_PROCESS
123444c061aSmrg#define UNLOCK_PROCESS
124444c061aSmrg#define LOCK_APP(app)
125444c061aSmrg#define UNLOCK_APP(app)
126444c061aSmrg
127444c061aSmrg#define INIT_APP_LOCK(app)
128444c061aSmrg#define FREE_APP_LOCK(app)
129444c061aSmrg
130444c061aSmrg#define WIDGET_TO_APPCON(w)
131444c061aSmrg#define DPY_TO_APPCON(d)
132444c061aSmrg
133444c061aSmrg#endif /* !defined(XTHREADS) */
134444c061aSmrg#endif /* _XtThreadsI_h */
135