xref: /relibc/pthreads-emb/global.c (revision 062c5bc4dfeed2c1bed58ed4810dd27adb32c68d)
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-embedded (PTE) - POSIX Threads Library for embedded systems
11  *      Copyright(C) 2008 Jason Schmidlapp
12  *
13  *      Contact Email: jschmidlapp@users.sourceforge.net
14  *
15  *
16  *      Based upon Pthreads-win32 - POSIX Threads Library for Win32
17  *      Copyright(C) 1998 John E. Bossom
18  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
19  *
20  *      Contact Email: rpj@callisto.canberra.edu.au
21  *
22  *      The original list of contributors to the Pthreads-win32 project
23  *      is contained in the file CONTRIBUTORS.ptw32 included with the
24  *      source code distribution. The list can also be seen at the
25  *      following World Wide Web location:
26  *      http://sources.redhat.com/pthreads-win32/contributors.html
27  *
28  *      This library is free software; you can redistribute it and/or
29  *      modify it under the terms of the GNU Lesser General Public
30  *      License as published by the Free Software Foundation; either
31  *      version 2 of the License, or (at your option) any later version.
32  *
33  *      This library is distributed in the hope that it will be useful,
34  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
35  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36  *      Lesser General Public License for more details.
37  *
38  *      You should have received a copy of the GNU Lesser General Public
39  *      License along with this library in the file COPYING.LIB;
40  *      if not, write to the Free Software Foundation, Inc.,
41  *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
42  */
43 
44 #include "pthread.h"
45 #include "implement.h"
46 
47 
48 int pte_processInitialized = PTE_FALSE;
49 pte_thread_t * pte_threadReuseTop = PTE_THREAD_REUSE_EMPTY;
50 pte_thread_t * pte_threadReuseBottom = PTE_THREAD_REUSE_EMPTY;
51 pthread_key_t pte_selfThreadKey = NULL;
52 pthread_key_t pte_cleanupKey = NULL;
53 pthread_cond_t pte_cond_list_head = NULL;
54 pthread_cond_t pte_cond_list_tail = NULL;
55 
56 int pte_concurrency = 0;
57 
58 /* What features have been auto-detaected */
59 int pte_features = 0;
60 
61 unsigned char pte_smp_system = PTE_TRUE;  /* Safer if assumed true initially. */
62 
63 /*
64  * Global lock for managing pthread_t struct reuse.
65  */
66 pte_osMutexHandle pte_thread_reuse_lock;
67 
68 /*
69  * Global lock for testing internal state of statically declared mutexes.
70  */
71 pte_osMutexHandle pte_mutex_test_init_lock;
72 
73 /*
74  * Global lock for testing internal state of PTHREAD_COND_INITIALIZER
75  * created condition variables.
76  */
77 pte_osMutexHandle pte_cond_test_init_lock;
78 
79 /*
80  * Global lock for testing internal state of PTHREAD_RWLOCK_INITIALIZER
81  * created read/write locks.
82  */
83 pte_osMutexHandle pte_rwlock_test_init_lock;
84 
85 /*
86  * Global lock for testing internal state of PTHREAD_SPINLOCK_INITIALIZER
87  * created spin locks.
88  */
89 pte_osMutexHandle pte_spinlock_test_init_lock;
90 
91 /*
92  * Global lock for condition variable linked list. The list exists
93  * to wake up CVs when a WM_TIMECHANGE message arrives. See
94  * w32_TimeChangeHandler.c.
95  */
96 pte_osMutexHandle pte_cond_list_lock;
97 
98 
99