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