| [2] | 1 | /* GNU Objective C Runtime Thread Interface.
|
|---|
| 2 | Copyright (C) 1999 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU CC.
|
|---|
| 5 |
|
|---|
| 6 | GNU CC is free software; you can redistribute it and/or modify it under the
|
|---|
| 7 | terms of the GNU General Public License as published by the Free Software
|
|---|
| 8 | Foundation; either version 2, or (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|---|
| 11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|---|
| 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|---|
| 13 | details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU General Public License
|
|---|
| 16 | along with GNU CC; see the file COPYING. If not, write to
|
|---|
| 17 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
|---|
| 18 | Boston, MA 02111-1307, USA. */
|
|---|
| 19 |
|
|---|
| 20 | /* As a special exception, if you link this library with files compiled with
|
|---|
| 21 | GCC to produce an executable, this does not cause the resulting executable
|
|---|
| 22 | to be covered by the GNU General Public License. This exception does not
|
|---|
| 23 | however invalidate any other reasons why the executable file might be
|
|---|
| 24 | covered by the GNU General Public License. */
|
|---|
| 25 |
|
|---|
| 26 | #define _LIBOBJC
|
|---|
| 27 | #include "tconfig.h"
|
|---|
| 28 | #include "defaults.h"
|
|---|
| 29 | #include <objc/thr.h>
|
|---|
| 30 | #include "runtime.h"
|
|---|
| 31 | #include <gthr.h>
|
|---|
| 32 |
|
|---|
| 33 | /* Backend initialization functions */
|
|---|
| 34 |
|
|---|
| 35 | /* Initialize the threads subsystem. */
|
|---|
| 36 | int
|
|---|
| 37 | __objc_init_thread_system(void)
|
|---|
| 38 | {
|
|---|
| 39 | return __gthread_objc_init_thread_system ();
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | /* Close the threads subsystem. */
|
|---|
| 43 | int
|
|---|
| 44 | __objc_close_thread_system(void)
|
|---|
| 45 | {
|
|---|
| 46 | return __gthread_objc_close_thread_system ();
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | /* Backend thread functions */
|
|---|
| 50 |
|
|---|
| 51 | /* Create a new thread of execution. */
|
|---|
| 52 | objc_thread_t
|
|---|
| 53 | __objc_thread_detach(void (*func)(void *), void *arg)
|
|---|
| 54 | {
|
|---|
| 55 | return __gthread_objc_thread_detach (func, arg);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | /* Set the current thread's priority. */
|
|---|
| 59 | int
|
|---|
| 60 | __objc_thread_set_priority(int priority)
|
|---|
| 61 | {
|
|---|
| 62 | return __gthread_objc_thread_set_priority (priority);
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | /* Return the current thread's priority. */
|
|---|
| 66 | int
|
|---|
| 67 | __objc_thread_get_priority(void)
|
|---|
| 68 | {
|
|---|
| 69 | return __gthread_objc_thread_get_priority ();
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | /* Yield our process time to another thread. */
|
|---|
| 73 | void
|
|---|
| 74 | __objc_thread_yield(void)
|
|---|
| |
|---|