Mercurial > hg > CbC > CbC_gcc
comparison gcc/gthr-win32.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children |
comparison
equal
deleted
inserted
replaced
52:c156f1bd5cd9 | 55:77e2b8dfacca |
---|---|
68 #define __GTHREADS 1 | 68 #define __GTHREADS 1 |
69 | 69 |
70 #include <errno.h> | 70 #include <errno.h> |
71 #ifdef __MINGW32__ | 71 #ifdef __MINGW32__ |
72 #include <_mingw.h> | 72 #include <_mingw.h> |
73 #endif | |
74 | |
75 #ifndef __UNUSED_PARAM | |
76 #define __UNUSED_PARAM(x) x | |
73 #endif | 77 #endif |
74 | 78 |
75 #ifdef _LIBOBJC | 79 #ifdef _LIBOBJC |
76 | 80 |
77 /* This is necessary to prevent windef.h (included from windows.h) from | 81 /* This is necessary to prevent windef.h (included from windows.h) from |
119 | 123 |
120 if (!(win32_handle = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) func, | 124 if (!(win32_handle = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) func, |
121 arg, 0, &thread_id))) | 125 arg, 0, &thread_id))) |
122 thread_id = 0; | 126 thread_id = 0; |
123 | 127 |
124 return (objc_thread_t) thread_id; | 128 return (objc_thread_t) (INT_PTR) thread_id; |
125 } | 129 } |
126 | 130 |
127 /* Set the current thread's priority. */ | 131 /* Set the current thread's priority. */ |
128 int | 132 int |
129 __gthread_objc_thread_set_priority (int priority) | 133 __gthread_objc_thread_set_priority (int priority) |
200 | 204 |
201 /* Returns an integer value which uniquely describes a thread. */ | 205 /* Returns an integer value which uniquely describes a thread. */ |
202 objc_thread_t | 206 objc_thread_t |
203 __gthread_objc_thread_id (void) | 207 __gthread_objc_thread_id (void) |
204 { | 208 { |
205 return (objc_thread_t) GetCurrentThreadId (); | 209 return (objc_thread_t) (INT_PTR) GetCurrentThreadId (); |
206 } | 210 } |
207 | 211 |
208 /* Sets the thread's local storage pointer. */ | 212 /* Sets the thread's local storage pointer. */ |
209 int | 213 int |
210 __gthread_objc_thread_set_data (void *value) | 214 __gthread_objc_thread_set_data (void *value) |
289 | 293 |
290 /* Backend condition mutex functions */ | 294 /* Backend condition mutex functions */ |
291 | 295 |
292 /* Allocate a condition. */ | 296 /* Allocate a condition. */ |
293 int | 297 int |
294 __gthread_objc_condition_allocate (objc_condition_t condition) | 298 __gthread_objc_condition_allocate (objc_condition_t __UNUSED_PARAM(condition)) |
295 { | 299 { |
296 /* Unimplemented. */ | 300 /* Unimplemented. */ |
297 return -1; | 301 return -1; |
298 } | 302 } |
299 | 303 |
300 /* Deallocate a condition. */ | 304 /* Deallocate a condition. */ |
301 int | 305 int |
302 __gthread_objc_condition_deallocate (objc_condition_t condition) | 306 __gthread_objc_condition_deallocate (objc_condition_t __UNUSED_PARAM(condition)) |
303 { | 307 { |
304 /* Unimplemented. */ | 308 /* Unimplemented. */ |
305 return -1; | 309 return -1; |
306 } | 310 } |
307 | 311 |
308 /* Wait on the condition */ | 312 /* Wait on the condition */ |
309 int | 313 int |
310 __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) | 314 __gthread_objc_condition_wait (objc_condition_t __UNUSED_PARAM(condition), |
315 objc_mutex_t __UNUSED_PARAM(mutex)) | |
311 { | 316 { |
312 /* Unimplemented. */ | 317 /* Unimplemented. */ |
313 return -1; | 318 return -1; |
314 } | 319 } |
315 | 320 |
316 /* Wake up all threads waiting on this condition. */ | 321 /* Wake up all threads waiting on this condition. */ |
317 int | 322 int |
318 __gthread_objc_condition_broadcast (objc_condition_t condition) | 323 __gthread_objc_condition_broadcast (objc_condition_t __UNUSED_PARAM(condition)) |
319 { | 324 { |
320 /* Unimplemented. */ | 325 /* Unimplemented. */ |
321 return -1; | 326 return -1; |
322 } | 327 } |
323 | 328 |
324 /* Wake up one thread waiting on this condition. */ | 329 /* Wake up one thread waiting on this condition. */ |
325 int | 330 int |
326 __gthread_objc_condition_signal (objc_condition_t condition) | 331 __gthread_objc_condition_signal (objc_condition_t __UNUSED_PARAM(condition)) |
327 { | 332 { |
328 /* Unimplemented. */ | 333 /* Unimplemented. */ |
329 return -1; | 334 return -1; |
330 } | 335 } |
331 | 336 |
359 #define __GTHREAD_MUTEX_INIT_DEFAULT {-1, 0} | 364 #define __GTHREAD_MUTEX_INIT_DEFAULT {-1, 0} |
360 #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION \ | 365 #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION \ |
361 __gthread_recursive_mutex_init_function | 366 __gthread_recursive_mutex_init_function |
362 #define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0} | 367 #define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0} |
363 | 368 |
364 #if __MINGW32_MAJOR_VERSION >= 1 || \ | 369 #if defined (_WIN32) && !defined(__CYGWIN__) |
365 (__MINGW32_MAJOR_VERSION == 0 && __MINGW32_MINOR_VERSION > 2) | |
366 #define MINGW32_SUPPORTS_MT_EH 1 | 370 #define MINGW32_SUPPORTS_MT_EH 1 |
367 /* Mingw runtime >= v0.3 provides a magic variable that is set to nonzero | 371 /* Mingw runtime >= v0.3 provides a magic variable that is set to nonzero |
368 if -mthreads option was specified, or 0 otherwise. This is to get around | 372 if -mthreads option was specified, or 0 otherwise. This is to get around |
369 the lack of weak symbols in PE-COFF. */ | 373 the lack of weak symbols in PE-COFF. */ |
370 extern int _CRT_MT; | 374 extern int _CRT_MT; |
371 extern int __mingwthr_key_dtor (unsigned long, void (*) (void *)); | 375 extern int __mingwthr_key_dtor (unsigned long, void (*) (void *)); |
372 #endif /* __MINGW32__ version */ | 376 #endif /* _WIN32 && !__CYGWIN__ */ |
373 | 377 |
374 /* The Windows95 kernel does not export InterlockedCompareExchange. | 378 /* The Windows95 kernel does not export InterlockedCompareExchange. |
375 This provides a substitute. When building apps that reference | 379 This provides a substitute. When building apps that reference |
376 gthread_mutex_try_lock, the __GTHREAD_I486_INLINE_LOCK_PRIMITIVES | 380 gthread_mutex_try_lock, the __GTHREAD_I486_INLINE_LOCK_PRIMITIVES |
377 macro must be defined if Windows95 is a target. Currently | 381 macro must be defined if Windows95 is a target. Currently |