16 |
*/ |
*/ |
17 |
/* Boehm, September 14, 1994 4:44 pm PDT */ |
/* Boehm, September 14, 1994 4:44 pm PDT */ |
18 |
|
|
|
# if defined(GC_SOLARIS_THREADS) || defined(GC_SOLARIS_PTHREADS) |
|
|
|
|
19 |
# include "private/gc_priv.h" |
# include "private/gc_priv.h" |
20 |
|
|
21 |
|
# if defined(GC_SOLARIS_THREADS) || defined(GC_SOLARIS_PTHREADS) |
22 |
# include "private/solaris_threads.h" |
# include "private/solaris_threads.h" |
23 |
# include <thread.h> |
# include <thread.h> |
24 |
# include <synch.h> |
# include <synch.h> |
248 |
for (i = 0; i < max_lwps; i++) |
for (i = 0; i < max_lwps; i++) |
249 |
last_ids[i] = 0; |
last_ids[i] = 0; |
250 |
for (;;) { |
for (;;) { |
251 |
if (syscall(SYS_ioctl, GC_main_proc_fd, PIOCSTATUS, &status) < 0) |
if (syscall(SYS_ioctl, GC_main_proc_fd, PIOCSTATUS, &status) < 0) |
252 |
ABORT("Main PIOCSTATUS failed"); |
ABORT("Main PIOCSTATUS failed"); |
253 |
if (status.pr_nlwp < 1) |
if (status.pr_nlwp < 1) |
254 |
ABORT("Invalid number of lwps returned by PIOCSTATUS"); |
ABORT("Invalid number of lwps returned by PIOCSTATUS"); |
255 |
if (status.pr_nlwp >= max_lwps) { |
if (status.pr_nlwp >= max_lwps) { |
262 |
for (i = 0; i < max_lwps; i++) |
for (i = 0; i < max_lwps; i++) |
263 |
last_ids[i] = 0; |
last_ids[i] = 0; |
264 |
continue; |
continue; |
265 |
} |
} |
266 |
if (syscall(SYS_ioctl, GC_main_proc_fd, PIOCLWPIDS, GC_current_ids) < 0) |
if (syscall(SYS_ioctl, GC_main_proc_fd, PIOCLWPIDS, GC_current_ids) < 0) |
267 |
ABORT("PIOCLWPIDS failed"); |
ABORT("PIOCLWPIDS failed"); |
268 |
changed = FALSE; |
changed = FALSE; |
786 |
{ |
{ |
787 |
GC_thread t; |
GC_thread t; |
788 |
thread_t tid; |
thread_t tid; |
789 |
|
int ret; |
790 |
|
|
791 |
if (GC_thr_initialized) |
if (GC_thr_initialized) |
792 |
return; |
return; |
804 |
t = GC_new_thread(thr_self()); |
t = GC_new_thread(thr_self()); |
805 |
t -> stack_size = 0; |
t -> stack_size = 0; |
806 |
t -> flags = DETACHED | CLIENT_OWNS_STACK; |
t -> flags = DETACHED | CLIENT_OWNS_STACK; |
807 |
if (thr_create(0 /* stack */, 0 /* stack_size */, GC_thr_daemon, |
ret = thr_create(0 /* stack */, 0 /* stack_size */, GC_thr_daemon, |
808 |
0 /* arg */, THR_DETACHED | THR_DAEMON, |
0 /* arg */, THR_DETACHED | THR_DAEMON, |
809 |
&tid /* thread_id */) != 0) { |
&tid /* thread_id */); |
810 |
|
if (ret != 0) { |
811 |
|
GC_err_printf1("Thr_create returned %ld\n", ret); |
812 |
ABORT("Cant fork daemon"); |
ABORT("Cant fork daemon"); |
813 |
} |
} |
814 |
thr_setprio(tid, 126); |
thr_setprio(tid, 126); |