OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libobjc/] [thr-objc.c] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* GNU Objective C Runtime Thread Interface.
2
   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006
3
   Free Software Foundation, Inc.
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify it under the
8
terms of the GNU General Public License as published by the Free Software
9
Foundation; either version 2, or (at your option) any later version.
10
 
11
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14
details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GCC; see the file COPYING.  If not, write to
18
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19
Boston, MA 02110-1301, USA.  */
20
 
21
/* As a special exception, if you link this library with files compiled with
22
   GCC to produce an executable, this does not cause the resulting executable
23
   to be covered by the GNU General Public License. This exception does not
24
   however invalidate any other reasons why the executable file might be
25
   covered by the GNU General Public License.  */
26
 
27
#define _LIBOBJC
28
/* The line below is needed for declarations of functions such as
29
   pthread_mutexattr_settype, without which gthr-posix.h may fail to
30
   compile within libobjc.  Unfortunately, this breaks compilation on
31
   Tru64 UNIX V4.0F, so disable it there.  */
32
#ifndef __osf__
33
#define _XOPEN_SOURCE 500
34
#endif
35
#include "config.h"
36
#include "tconfig.h"
37
#include "coretypes.h"
38
#include "tm.h"
39
#include "defaults.h"
40
#include "objc/thr.h"
41
#include "objc/runtime.h"
42
#include <gthr.h>
43
 
44
/* Backend initialization functions */
45
 
46
/* Initialize the threads subsystem. */
47
int
48
__objc_init_thread_system(void)
49
{
50
  return __gthread_objc_init_thread_system ();
51
}
52
 
53
/* Close the threads subsystem. */
54
int
55
__objc_close_thread_system(void)
56
{
57
  return __gthread_objc_close_thread_system ();
58
}
59
 
60
/* Backend thread functions */
61
 
62
/* Create a new thread of execution. */
63
objc_thread_t
64
__objc_thread_detach(void (*func)(void *), void *arg)
65
{
66
  return __gthread_objc_thread_detach (func, arg);
67
}
68
 
69
/* Set the current thread's priority. */
70
int
71
__objc_thread_set_priority(int priority)
72
{
73
  return __gthread_objc_thread_set_priority (priority);
74
}
75
 
76
/* Return the current thread's priority. */
77
int
78
__objc_thread_get_priority(void)
79
{
80
  return __gthread_objc_thread_get_priority ();
81
}
82
 
83
/* Yield our process time to another thread. */
84
void
85
__objc_thread_yield(void)
86
{
87
  __gthread_objc_thread_yield ();
88
}
89
 
90
/* Terminate the current thread. */
91
int
92
__objc_thread_exit(void)
93
{
94
  return __gthread_objc_thread_exit ();
95
}
96
 
97
/* Returns an integer value which uniquely describes a thread. */
98
objc_thread_t
99
__objc_thread_id(void)
100
{
101
  return __gthread_objc_thread_id ();
102
}
103
 
104
/* Sets the thread's local storage pointer. */
105
int
106
__objc_thread_set_data(void *value)
107
{
108
  return __gthread_objc_thread_set_data (value);
109
}
110
 
111
/* Returns the thread's local storage pointer. */
112
void *
113
__objc_thread_get_data(void)
114
{
115
  return __gthread_objc_thread_get_data ();
116
}
117
 
118
/* Backend mutex functions */
119
 
120
/* Allocate a mutex. */
121
int
122
__objc_mutex_allocate(objc_mutex_t mutex)
123
{
124
  return __gthread_objc_mutex_allocate (mutex);
125
}
126
 
127
/* Deallocate a mutex. */
128
int
129
__objc_mutex_deallocate(objc_mutex_t mutex)
130
{
131
  return __gthread_objc_mutex_deallocate (mutex);
132
}
133
 
134
/* Grab a lock on a mutex. */
135
int
136
__objc_mutex_lock(objc_mutex_t mutex)
137
{
138
  return __gthread_objc_mutex_lock (mutex);
139
}
140
 
141
/* Try to grab a lock on a mutex. */
142
int
143
__objc_mutex_trylock(objc_mutex_t mutex)
144
{
145
  return __gthread_objc_mutex_trylock (mutex);
146
}
147
 
148
/* Unlock the mutex */
149
int
150
__objc_mutex_unlock(objc_mutex_t mutex)
151
{
152
  return __gthread_objc_mutex_unlock (mutex);
153
}
154
 
155
/* Backend condition mutex functions */
156
 
157
/* Allocate a condition. */
158
int
159
__objc_condition_allocate(objc_condition_t condition)
160
{
161
  return __gthread_objc_condition_allocate (condition);
162
}
163
 
164
/* Deallocate a condition. */
165
int
166
__objc_condition_deallocate(objc_condition_t condition)
167
{
168
  return __gthread_objc_condition_deallocate (condition);
169
}
170
 
171
/* Wait on the condition */
172
int
173
__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
174
{
175
  return __gthread_objc_condition_wait (condition, mutex);
176
}
177
 
178
/* Wake up all threads waiting on this condition. */
179
int
180
__objc_condition_broadcast(objc_condition_t condition)
181
{
182
  return __gthread_objc_condition_broadcast (condition);
183
}
184
 
185
/* Wake up one thread waiting on this condition. */
186
int
187
__objc_condition_signal(objc_condition_t condition)
188
{
189
  return __gthread_objc_condition_signal (condition);
190
}
191
 
192
/* End of File */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.