summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_init.c
diff options
context:
space:
mode:
authormini <mini@FreeBSD.org>2002-10-30 06:07:18 +0000
committermini <mini@FreeBSD.org>2002-10-30 06:07:18 +0000
commitee4068ef29f700291bdfe8867286996571bb58aa (patch)
tree0bf6e4da0afbcb394be3c20c8b89b3a674bd8c07 /lib/libpthread/thread/thr_init.c
parenta8da55afda685ca2151899c0d25f837c962b9670 (diff)
downloadFreeBSD-src-ee4068ef29f700291bdfe8867286996571bb58aa.zip
FreeBSD-src-ee4068ef29f700291bdfe8867286996571bb58aa.tar.gz
Use KSE to schedule threads.
Diffstat (limited to 'lib/libpthread/thread/thr_init.c')
-rw-r--r--lib/libpthread/thread/thr_init.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c
index 9f6a533..4dd356a 100644
--- a/lib/libpthread/thread/thr_init.c
+++ b/lib/libpthread/thread/thr_init.c
@@ -266,15 +266,12 @@ _thread_init(void)
_thread_initial->attr.stackaddr_attr = _thread_initial->stack;
_thread_initial->attr.stacksize_attr = PTHREAD_STACK_INITIAL;
- /* Setup the context for the scheduler: */
- getcontext(&_thread_kern_sched_ctx);
- _thread_kern_sched_ctx.uc_stack.ss_sp =
+ /* Setup the context for the scheduler. */
+ _thread_kern_kse_mailbox.km_stack.ss_sp =
_thread_kern_sched_stack;
- _thread_kern_sched_ctx.uc_stack.ss_size = sched_stack_size;
- makecontext(&_thread_kern_sched_ctx, _thread_kern_scheduler, 1);
-
- /* Block all signals to the scheduler's context. */
- sigfillset(&_thread_kern_sched_ctx.uc_sigmask);
+ _thread_kern_kse_mailbox.km_stack.ss_size = sched_stack_size;
+ _thread_kern_kse_mailbox.km_func =
+ (void *)_thread_kern_scheduler;
/*
* Write a magic value to the thread structure
@@ -287,9 +284,12 @@ _thread_init(void)
PTHREAD_CANCEL_DEFERRED;
/* Setup the context for initial thread. */
- getcontext(&_thread_initial->ctx);
- _thread_kern_sched_ctx.uc_stack.ss_sp = _thread_initial->stack;
- _thread_kern_sched_ctx.uc_stack.ss_size = PTHREAD_STACK_INITIAL;
+ getcontext(&_thread_initial->mailbox.tm_context);
+ _thread_initial->mailbox.tm_context.uc_stack.ss_sp =
+ _thread_initial->stack;
+ _thread_initial->mailbox.tm_context.uc_stack.ss_size =
+ PTHREAD_STACK_INITIAL;
+ _thread_initial->mailbox.tm_udata = (void *)_thread_initial;
/* Default the priority of the initial thread: */
_thread_initial->base_priority = PTHREAD_DEFAULT_PRIORITY;
@@ -334,6 +334,11 @@ _thread_init(void)
_clock_res_usec = clockinfo.tick > CLOCK_RES_USEC_MIN ?
clockinfo.tick : CLOCK_RES_USEC_MIN;
+ /* Start KSE. */
+ _thread_kern_kse_mailbox.km_curthread =
+ &_thread_initial->mailbox;
+ if (kse_create(&_thread_kern_kse_mailbox, 0) != 0)
+ PANIC("kse_new failed");
}
/* Initialise the garbage collector mutex and condition variable. */
OpenPOWER on IntegriCloud