| [2] | 1 | /* GNU Objective C Runtime Thread Interface - SGI IRIX Implementation
|
|---|
| 2 | Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
|---|
| 3 | Contributed by Galen C. Hunt ([email protected])
|
|---|
| 4 |
|
|---|
| 5 | This file is part of GNU CC.
|
|---|
| 6 |
|
|---|
| 7 | GNU CC 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 | GNU CC 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 along with
|
|---|
| 17 | GNU CC; see the file COPYING. If not, write to the Free Software
|
|---|
| 18 | Foundation, 59 Temple Place - Suite 330,
|
|---|
| 19 | Boston, MA 02111-1307, 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 | #include <stdlib.h>
|
|---|
| 28 | #include <sys/types.h>
|
|---|
| 29 | #include <sys/sysmp.h>
|
|---|
| 30 | #include <sys/prctl.h>
|
|---|
| 31 | #include <ulocks.h>
|
|---|
| 32 | #include <objc/thr.h>
|
|---|
| 33 | #include "runtime.h"
|
|---|
| 34 |
|
|---|
| 35 | /* Key structure for maintaining thread specific storage */
|
|---|
| 36 | static void * __objc_shared_arena_handle = NULL;
|
|---|
| 37 |
|
|---|
| 38 | /* Backend initialization functions */
|
|---|
| 39 |
|
|---|
| 40 | /* Initialize the threads subsystem. */
|
|---|
| 41 | int
|
|---|
| 42 | __objc_init_thread_system(void)
|
|---|
| 43 | {
|
|---|
| 44 | /* Name of IRIX arena. */
|
|---|
| 45 | char arena_name[64];
|
|---|
| 46 |
|
|---|
| 47 | DEBUG_PRINTF("__objc_init_thread_system\n");
|
|---|
| 48 |
|
|---|
| 49 | /* Construct a temporary name for arena. */
|
|---|
| 50 | sprintf(arena_name, "/usr/tmp/objc_%05u", (unsigned)getpid());
|
|---|
| 51 |
|
|---|
| 52 | /* Up to 256 threads. Arena only for threads. */
|
|---|
| 53 | usconfig(CONF_INITUSERS, 256);
|
|---|
| 54 | usconfig(CONF_ARENATYPE, US_SHAREDONLY);
|
|---|
| 55 |
|
|---|
| 56 | /* Initialize the arena */
|
|---|
| 57 | if (!(__objc_shared_arena_handle = usinit(arena_name)))
|
|---|
| 58 | /* Failed */
|
|---|
| 59 | return -1;
|
|---|
| 60 |
|
|---|
| 61 | return 0;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | /* Close the threads subsystem. */
|
|---|
| 65 | int
|
|---|
| 66 | __objc_close_thread_system(void)
|
|---|
| 67 | {
|
|---|
| 68 | return 0;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | /* Backend thread functions */
|
|---|
| 72 |
|
|---|
| |
|---|