thr-single.c
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:4k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. /* GNU Objective C Runtime Thread Implementation
  2.    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  3.    Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
  4. This file is part of GNU CC.
  5. GNU CC is free software; you can redistribute it and/or modify it under the
  6. terms of the GNU General Public License as published by the Free Software
  7. Foundation; either version 2, or (at your option) any later version.
  8. GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  11. details.
  12. You should have received a copy of the GNU General Public License along with
  13. GNU CC; see the file COPYING.  If not, write to the Free Software
  14. Foundation, 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.  */
  16. /* As a special exception, if you link this library with files compiled with
  17.    GCC to produce an executable, this does not cause the resulting executable
  18.    to be covered by the GNU General Public License. This exception does not
  19.    however invalidate any other reasons why the executable file might be
  20.    covered by the GNU General Public License.  */
  21. #include <objc/thr.h>
  22. #include "runtime.h"
  23. /* Thread local storage for a single thread */
  24. static void *thread_local_storage = NULL;
  25. /* Backend initialization functions */
  26. /* Initialize the threads subsystem. */
  27. int
  28. __objc_init_thread_system(void)
  29. {
  30.   /* No thread support available */
  31.   return -1;
  32. }
  33. /* Close the threads subsystem. */
  34. int
  35. __objc_close_thread_system(void)
  36. {
  37.   /* No thread support available */
  38.   return -1;
  39. }
  40. /* Backend thread functions */
  41. /* Create a new thread of execution. */
  42. objc_thread_t
  43. __objc_thread_detach(void (*func)(void *arg), void *arg)
  44. {
  45.   /* No thread support available */
  46.   return NULL;
  47. }
  48. /* Set the current thread's priority. */
  49. int
  50. __objc_thread_set_priority(int priority)
  51. {
  52.   /* No thread support available */
  53.   return -1;
  54. }
  55. /* Return the current thread's priority. */
  56. int
  57. __objc_thread_get_priority(void)
  58. {
  59.   return OBJC_THREAD_INTERACTIVE_PRIORITY;
  60. }
  61. /* Yield our process time to another thread. */
  62. void
  63. __objc_thread_yield(void)
  64. {
  65.   return;
  66. }
  67. /* Terminate the current thread. */
  68. int
  69. __objc_thread_exit(void)
  70. {
  71.   /* No thread support available */
  72.   /* Should we really exit the program */
  73.   /* exit(&__objc_thread_exit_status); */
  74.   return -1;
  75. }
  76. /* Returns an integer value which uniquely describes a thread. */
  77. objc_thread_t
  78. __objc_thread_id(void)
  79. {
  80.   /* No thread support, use 1. */
  81.   return (objc_thread_t)1;
  82. }
  83. /* Sets the thread's local storage pointer. */
  84. int
  85. __objc_thread_set_data(void *value)
  86. {
  87.   thread_local_storage = value;
  88.   return 0;
  89. }
  90. /* Returns the thread's local storage pointer. */
  91. void *
  92. __objc_thread_get_data(void)
  93. {
  94.   return thread_local_storage;
  95. }
  96. /* Backend mutex functions */
  97. /* Allocate a mutex. */
  98. int
  99. __objc_mutex_allocate(objc_mutex_t mutex)
  100. {
  101.   return 0;
  102. }
  103. /* Deallocate a mutex. */
  104. int
  105. __objc_mutex_deallocate(objc_mutex_t mutex)
  106. {
  107.   return 0;
  108. }
  109. /* Grab a lock on a mutex. */
  110. int
  111. __objc_mutex_lock(objc_mutex_t mutex)
  112. {
  113.   /* There can only be one thread, so we always get the lock */
  114.   return 0;
  115. }
  116. /* Try to grab a lock on a mutex. */
  117. int
  118. __objc_mutex_trylock(objc_mutex_t mutex)
  119. {
  120.   /* There can only be one thread, so we always get the lock */
  121.   return 0;
  122. }
  123. /* Unlock the mutex */
  124. int
  125. __objc_mutex_unlock(objc_mutex_t mutex)
  126. {
  127.   return 0;
  128. }
  129. /* Backend condition mutex functions */
  130. /* Allocate a condition. */
  131. int
  132. __objc_condition_allocate(objc_condition_t condition)
  133. {
  134.   return 0;
  135. }
  136. /* Deallocate a condition. */
  137. int
  138. __objc_condition_deallocate(objc_condition_t condition)
  139. {
  140.   return 0;
  141. }
  142. /* Wait on the condition */
  143. int
  144. __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
  145. {
  146.   return 0;
  147. }
  148. /* Wake up all threads waiting on this condition. */
  149. int
  150. __objc_condition_broadcast(objc_condition_t condition)
  151. {
  152.   return 0;
  153. }
  154. /* Wake up one thread waiting on this condition. */
  155. int
  156. __objc_condition_signal(objc_condition_t condition)
  157. {
  158.   return 0;
  159. }
  160. /* End of File */