global.c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #include "pthread.h"
  44. #include "implement.h"
  45. int pte_processInitialized = PTE_FALSE;
  46. pte_thread_t * pte_threadReuseTop = PTE_THREAD_REUSE_EMPTY;
  47. pte_thread_t * pte_threadReuseBottom = PTE_THREAD_REUSE_EMPTY;
  48. pthread_key_t pte_selfThreadKey = NULL;
  49. pthread_key_t pte_cleanupKey = NULL;
  50. pthread_cond_t pte_cond_list_head = NULL;
  51. pthread_cond_t pte_cond_list_tail = NULL;
  52. int pte_concurrency = 0;
  53. /* What features have been auto-detaected */
  54. int pte_features = 0;
  55. unsigned char pte_smp_system = PTE_TRUE; /* Safer if assumed true initially. */
  56. /*
  57. * Global lock for managing pthread_t struct reuse.
  58. */
  59. pte_osMutexHandle pte_thread_reuse_lock;
  60. /*
  61. * Global lock for testing internal state of statically declared mutexes.
  62. */
  63. pte_osMutexHandle pte_mutex_test_init_lock;
  64. /*
  65. * Global lock for testing internal state of PTHREAD_COND_INITIALIZER
  66. * created condition variables.
  67. */
  68. pte_osMutexHandle pte_cond_test_init_lock;
  69. /*
  70. * Global lock for testing internal state of PTHREAD_RWLOCK_INITIALIZER
  71. * created read/write locks.
  72. */
  73. pte_osMutexHandle pte_rwlock_test_init_lock;
  74. /*
  75. * Global lock for testing internal state of PTHREAD_SPINLOCK_INITIALIZER
  76. * created spin locks.
  77. */
  78. pte_osMutexHandle pte_spinlock_test_init_lock;
  79. /*
  80. * Global lock for condition variable linked list. The list exists
  81. * to wake up CVs when a WM_TIMECHANGE message arrives. See
  82. * w32_TimeChangeHandler.c.
  83. */
  84. pte_osMutexHandle pte_cond_list_lock;