Daniel Eischen eischen at vigrid.com
Fri Jan 16 18:02:16 PST 2004

On Sat, 17 Jan 2004, David Xu wrote:

> There is a conflict between MINSIGSTKSZ and PTHREAD_STACK_MIN,
> PTHREAD_STACK_MIN defined in pthread.h has a fixed value 1024,
> MINSIGSTKSZ is variable on per-architecture, on i386,  it is defined in
> sys/i386/include/signal.h:
> #define      MINSIGSTKSZ     (512 * 4)
> so on i386, makecontext is failed when user specifies PTHREAD_STACK_MIN
> for new thread,  result is we get following message in libkse:
> Fatal error 'Thread has returned from _thread_switch' at line 1099 in file
>  /usr/home/davidxu/src/lib/libpthread/thread/thr_kern.c (errno = 0)
> This becauses context is not fully initialized in pthread_create.
> Either makecontext shouldn't check stacksize or we should synchoronize

I think PTHREAD_STACK_MIN should also be per-architecture and be
>= MINSIGSTKSZ (otherwise threads wouldn't have enough stack to
handle signals).

Dan Eischen

More information about the freebsd-threads mailing list