2
* $XFree86: xc/lib/XThrStub/UIThrStubs.c,v 3.4 2003/01/15 02:55:16 dawes Exp $
4
* Copyright (c) 1995 David E. Wexelblat. All rights reserved
6
* Permission is hereby granted, free of charge, to any person obtaining
7
* a copy of this software and associated documentation files (the
8
* "Software"), to deal in the Software without restriction, including
9
* without limitation the rights to use, copy, modify, merge, publish,
10
* distribute, sublicense, and/or sell copies of the Software, and to
11
* permit persons to whom the Software is furnished to do so, subject to
12
* the following conditions:
14
* The above copyright notice and this permission notice shall be included
15
* in all copies or substantial portions of the Software.
17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
* IN NO EVENT SHALL DAVID E. WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
* OTHER DEALINGS IN THE SOFTWARE.
25
* Except as contained in this notice, the name of David E. Wexelblat shall
26
* not be used in advertising or otherwise to promote the sale, use or
27
* other dealings in this Software without prior written authorization
28
* from David E. Wexelblat.
33
* Stubs for thread functions needed by the X library. Supports
34
* UnixWare 2.x threads; may support Solaris 2 threads as well, but not
35
* tested. Defining things this way removes the dependency of the X
36
* library on the threads library, but still supports threads if the user
37
* specificies the thread library on the link line.
41
* Modifications by Carlos A M dos Santos, XFree86 Project, November 1999.
43
* Explanation from <X11/Xos_r.h>:
44
* The structure below is complicated, mostly because P1003.1c (the
45
* IEEE POSIX Threads spec) went through lots of drafts, and some
46
* vendors shipped systems based on draft API that were changed later.
47
* Unfortunately POSIX did not provide a feature-test macro for
48
* distinguishing each of the drafts.
53
typedef cthread_t xthread_t;
54
#define xthread_self cthread_self
55
#pragma weak cthread_self = _Xthr_self_stub_
56
#define xmutex_init mutex_init
57
#pragma weak mutex_init = _Xthr_zero_stub_
58
#pragma weak mutex_clear = _Xthr_zero_stub_
59
#pragma weak mutex_lock = _Xthr_zero_stub_
60
#pragma weak mutex_unlock = _Xthr_zero_stub_
61
#pragma weak condition_init = _Xthr_zero_stub_
62
#pragma weak condition_clear = _Xthr_zero_stub_
63
#pragma weak condition_wait = _Xthr_zero_stub_
64
#pragma weak condition_signal = _Xthr_zero_stub_
65
#pragma weak condition_broadcast = _Xthr_zero_stub_
67
#if defined(SVR4) && !defined(__sgi)
69
typedef thread_t xthread_t;
70
#pragma weak thr_self = _Xthr_self_stub_
71
#pragma weak mutex_init = _Xthr_zero_stub_
72
#pragma weak mutex_destroy = _Xthr_zero_stub_
73
#pragma weak mutex_lock = _Xthr_zero_stub_
74
#pragma weak mutex_unlock = _Xthr_zero_stub_
75
#pragma weak cond_init = _Xthr_zero_stub_
76
#pragma weak cond_destroy = _Xthr_zero_stub_
77
#pragma weak cond_wait = _Xthr_zero_stub_
78
#pragma weak cond_signal = _Xthr_zero_stub_
79
#pragma weak cond_broadcast = _Xthr_zero_stub_
83
* Don't know what to do here. Is there something do be done at all?
86
#ifdef USE_TIS_SUPPORT
88
typedef pthread_t xthread_t;
89
#pragma weak tis_self = _Xthr_self_stub_
90
#pragma weak tis_mutex_init = _Xthr_zero_stub_
91
#pragma weak tis_mutex_destroy = _Xthr_zero_stub_
92
#pragma weak tis_mutex_lock = _Xthr_zero_stub_
93
#pragma weak tis_mutex_unlock = _Xthr_zero_stub_
94
#pragma weak tis_cond_init = _Xthr_zero_stub_
95
#pragma weak tis_cond_destroy = _Xthr_zero_stub_
96
#pragma weak tis_cond_wait = _Xthr_zero_stub_
97
#pragma weak tis_cond_signal = _Xthr_zero_stub_
98
#pragma weak tis_cond_broadcast = _Xthr_zero_stub_
101
typedef pthread_t xthread_t;
103
xthread_t pthread_self() __attribute__ ((weak, alias ("_Xthr_self_stub_")));
104
int pthread_mutex_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
105
int pthread_mutex_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
106
int pthread_mutex_lock() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
107
int pthread_mutex_unlock() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
108
int pthread_cond_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
109
int pthread_cond_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
110
int pthread_cond_wait() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
111
int pthread_cond_signal() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
112
int pthread_cond_broadcast() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
113
int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
114
void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
115
int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_")));
117
#pragma weak pthread_self = _Xthr_self_stub_
118
#pragma weak pthread_mutex_init = _Xthr_zero_stub_
119
#pragma weak pthread_mutex_destroy = _Xthr_zero_stub_
120
#pragma weak pthread_mutex_lock = _Xthr_zero_stub_
121
#pragma weak pthread_mutex_unlock = _Xthr_zero_stub_
122
#pragma weak pthread_cond_init = _Xthr_zero_stub_
123
#pragma weak pthread_cond_destroy = _Xthr_zero_stub_
124
#pragma weak pthread_cond_wait = _Xthr_zero_stub_
125
#pragma weak pthread_cond_signal = _Xthr_zero_stub_
126
#pragma weak pthread_cond_broadcast = _Xthr_zero_stub_
127
/* These are added for libGL */
128
#pragma weak pthread_key_create = _Xthr_zero_stub_
129
#pragma weak pthread_getspecific = _Xthr_zero_stub_
130
#pragma weak pthread_setspecific = _Xthr_zero_stub_
131
#endif /* __GNUC__ */
132
#if defined(_DECTHREADS_) || defined(linux)
133
#pragma weak pthread_equal = _Xthr_equal_stub_ /* See Xthreads.h! */
139
#endif /* _DECTHREADS_ || linux */
140
#endif /* USE_TIS_SUPPORT */
143
#endif /* CTHREADS */
148
static xthread_t _X_no_thread_id;
150
return(_X_no_thread_id); /* defined by <X11/Xthreads.h> */