On Sun, Jan 23, 2011 at 09:04:46PM +0100, Stefan Sperling wrote:
> With this patch to libpthread, an OpenBSD guest in a qemu run with
> pthreads (not rthreads) has finished a cvs checkout and a kernel build.
> I'm starting a make build on it now.

Forgot to mention: The earlier patches to qemu are *not* needed with
this libpthread patch.

> Index: uthread/pthread_private.h
> ===================================================================
> RCS file: /cvs/src/lib/libpthread/uthread/pthread_private.h,v
> retrieving revision 1.76
> diff -u -p -r1.76 pthread_private.h
> --- uthread/pthread_private.h 28 Oct 2010 15:02:41 -0000      1.76
> +++ uthread/pthread_private.h 22 Jan 2011 17:07:45 -0000
> @@ -761,7 +761,7 @@ struct pthread {
>        * Set to non-zero when this thread has deferred signals.
>        * We allow for recursive deferral.
>        */
> -     int             sig_defer_count;
> +     volatile sig_atomic_t   sig_defer_count;
>  
>       /*
>        * Set to TRUE if this thread should yield after undeferring
> Index: uthread/uthread_kern.c
> ===================================================================
> RCS file: /cvs/src/lib/libpthread/uthread/uthread_kern.c,v
> retrieving revision 1.36
> diff -u -p -r1.36 uthread_kern.c
> --- uthread/uthread_kern.c    21 May 2007 16:50:36 -0000      1.36
> +++ uthread/uthread_kern.c    23 Jan 2011 15:18:03 -0000
> @@ -440,6 +440,12 @@ _thread_kern_sched(struct sigcontext * s
>                               _queue_signals = 0;
>                       }
>  
> +                     /*
> +                      * Prevent the signal handler from fiddling with this
> +                      * thread before its state is set.
> +                      */
> +                     _queue_signals = 1;
> +
>                       /* Make the selected thread the current thread: */
>                       _set_curthread(pthread_h);
>                       curthread = pthread_h;
> @@ -481,6 +487,9 @@ _thread_kern_sched(struct sigcontext * s
>                        */
>                       curthread = _get_curthread();
>                       _thread_kern_in_sched = 0;
> +
> +                     /* Allow signals again. */
> +                     _queue_signals = 0;
>  
>                       /* run any installed switch-hooks */
>                       if ((_sched_switch_hook != NULL) &&

Reply via email to