Date: Sun, 8 Sep 2002 01:45:15 -0700 (PDT) From: Jonathan Mini <mini@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 17228 for review Message-ID: <200209080845.g888jFsL080528@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17228 Change 17228 by mini@mini_stylus on 2002/09/08 01:45:11 Use a thread_mailbox instead of a ucontext_t to store thread state. Affected files ... .. //depot/projects/kse/lib/libc_r/uthread/pthread_private.h#8 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_create.c#5 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_init.c#6 edit .. //depot/projects/kse/lib/libc_r/uthread/uthread_kern.c#7 edit Differences ... ==== //depot/projects/kse/lib/libc_r/uthread/pthread_private.h#8 (text+ko) ==== @@ -55,6 +55,7 @@ #include <sys/types.h> #include <sys/time.h> #include <sys/cdefs.h> +#include <sys/kse.h> #include <sched.h> #include <spinlock.h> #include <ucontext.h> @@ -511,7 +512,7 @@ /* * Machine context, including signal state. */ - ucontext_t ctx; + struct thread_mailbox mailbox; /* * Cancelability flags - the lower 2 bits are used by cancel ==== //depot/projects/kse/lib/libc_r/uthread/uthread_create.c#5 (text+ko) ==== @@ -50,7 +50,7 @@ int _thread_uniqueid_offset = OFF(uniqueid); int _thread_state_offset = OFF(state); int _thread_name_offset = OFF(name); -int _thread_ctx_offset = OFF(ctx); +int _thread_ctx_offset = OFF(mailbox.tm_context); #undef OFF int _thread_PS_RUNNING_value = PS_RUNNING; @@ -122,11 +122,13 @@ new_thread->magic = PTHREAD_MAGIC; /* Initialise the machine context: */ - getcontext(&new_thread->ctx); - new_thread->ctx.uc_stack.ss_sp = new_thread->stack; - new_thread->ctx.uc_stack.ss_size = + getcontext(&new_thread->mailbox.tm_context); + new_thread->mailbox.tm_context.uc_stack.ss_sp = new_thread->stack; + new_thread->mailbox.tm_context.uc_stack.ss_size = pattr->stacksize_attr; - makecontext(&new_thread->ctx, _thread_start, 1); + makecontext(&new_thread->mailbox.tm_context, + _thread_start, 1); + new_thread->mailbox.tm_udata = (void *)new_thread; /* Copy the thread attributes: */ memcpy(&new_thread->attr, pattr, sizeof(struct pthread_attr)); ==== //depot/projects/kse/lib/libc_r/uthread/uthread_init.c#6 (text+ko) ==== @@ -287,7 +287,7 @@ PTHREAD_CANCEL_DEFERRED; /* Setup the context for initial thread. */ - getcontext(&_thread_initial->ctx); + getcontext(&_thread_initial->mailbox.tm_context); _thread_kern_sched_ctx.uc_stack.ss_sp = _thread_initial->stack; _thread_kern_sched_ctx.uc_stack.ss_size = PTHREAD_STACK_INITIAL; ==== //depot/projects/kse/lib/libc_r/uthread/uthread_kern.c#7 (text+ko) ==== @@ -83,7 +83,7 @@ _thread_kern_in_sched = 1; /* Switch into the scheduler's context. */ - swapcontext(&curthread->ctx, &_thread_kern_sched_ctx); + swapcontext(&curthread->mailbox.tm_context, &_thread_kern_sched_ctx); DBG_MSG("Returned from swapcontext, thread %p\n", curthread); /* @@ -385,7 +385,8 @@ /* * Continue the thread at its current frame: */ - swapcontext(&_thread_kern_sched_ctx, &curthread->ctx); + swapcontext(&_thread_kern_sched_ctx, + &curthread->mailbox.tm_context); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209080845.g888jFsL080528>