/[pcsx2_0.9.7]/trunk/3rdparty/w32pthreads/global.c
ViewVC logotype

Contents of /trunk/3rdparty/w32pthreads/global.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 10 months ago) by william
File MIME type: text/plain
File size: 3651 byte(s)
committing r3113 initial commit again...
1 /*
2 * global.c
3 *
4 * Description:
5 * This translation unit instantiates data associated with the implementation
6 * as a whole.
7 *
8 * --------------------------------------------------------------------------
9 *
10 * Pthreads-win32 - POSIX Threads Library for Win32
11 * Copyright(C) 1998 John E. Bossom
12 * Copyright(C) 1999,2005 Pthreads-win32 contributors
13 *
14 * Contact Email: rpj@callisto.canberra.edu.au
15 *
16 * The current list of contributors is contained
17 * in the file CONTRIBUTORS included with the source
18 * code distribution. The list can also be seen at the
19 * following World Wide Web location:
20 * http://sources.redhat.com/pthreads-win32/contributors.html
21 *
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License as published by the Free Software Foundation; either
25 * version 2 of the License, or (at your option) any later version.
26 *
27 * This library is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 * Lesser General Public License for more details.
31 *
32 * You should have received a copy of the GNU Lesser General Public
33 * License along with this library in the file COPYING.LIB;
34 * if not, write to the Free Software Foundation, Inc.,
35 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
36 */
37
38 #include "ptw32pch.h"
39
40
41 int ptw32_processInitialized = PTW32_FALSE;
42 ptw32_thread_t * ptw32_threadReuseTop = PTW32_THREAD_REUSE_EMPTY;
43 ptw32_thread_t * ptw32_threadReuseBottom = PTW32_THREAD_REUSE_EMPTY;
44 pthread_key_t ptw32_selfThreadKey = NULL;
45 pthread_key_t ptw32_cleanupKey = NULL;
46 pthread_cond_t ptw32_cond_list_head = NULL;
47 pthread_cond_t ptw32_cond_list_tail = NULL;
48
49 long ptw32_testcancel_enable = 0;
50
51 int ptw32_concurrency = 0;
52
53 /* What features have been auto-detaected */
54 int ptw32_features = 0;
55
56 #if 0
57 /*
58 * Function pointer to InterlockedCompareExchange if it exists, otherwise
59 * it will be set at runtime to a substitute local version with the same
60 * functionality but may be architecture specific.
61 */
62 PTW32_INTERLOCKED_LONG
63 (WINAPI * ptw32_interlocked_compare_exchange) (PTW32_INTERLOCKED_LPLONG,
64 PTW32_INTERLOCKED_LONG,
65 PTW32_INTERLOCKED_LONG) =
66 NULL;
67 #endif
68
69 /*
70 * Function pointer to QueueUserAPCEx if it exists, otherwise
71 * it will be set at runtime to a substitute routine which cannot unblock
72 * blocked threads.
73 */
74 DWORD (*ptw32_register_cancelation) (PAPCFUNC, HANDLE, DWORD) = NULL;
75
76 /*
77 * Global lock for managing pthread_t struct reuse.
78 */
79 CRITICAL_SECTION ptw32_thread_reuse_lock;
80
81 /*
82 * Global lock for testing internal state of statically declared mutexes.
83 */
84 CRITICAL_SECTION ptw32_mutex_test_init_lock;
85
86 /*
87 * Global lock for testing internal state of PTHREAD_COND_INITIALIZER
88 * created condition variables.
89 */
90 CRITICAL_SECTION ptw32_cond_test_init_lock;
91
92 /*
93 * Global lock for testing internal state of PTHREAD_RWLOCK_INITIALIZER
94 * created read/write locks.
95 */
96 CRITICAL_SECTION ptw32_rwlock_test_init_lock;
97
98 /*
99 * Global lock for testing internal state of PTHREAD_SPINLOCK_INITIALIZER
100 * created spin locks.
101 */
102 CRITICAL_SECTION ptw32_spinlock_test_init_lock;
103
104 /*
105 * Global lock for condition variable linked list. The list exists
106 * to wake up CVs when a WM_TIMECHANGE message arrives. See
107 * w32_TimeChangeHandler.c.
108 */
109 CRITICAL_SECTION ptw32_cond_list_lock;
110
111 #ifdef _UWIN
112 /*
113 * Keep a count of the number of threads.
114 */
115 int pthread_count = 0;
116 #endif

  ViewVC Help
Powered by ViewVC 1.1.22