Opened 16 years ago
Closed 16 years ago
#2559 closed enhancement (fixed)
[pthreads] Define PTHREAD_STACK_MIN
Reported by: | andreasf | Owned by: | axeld |
---|---|---|---|
Priority: | low | Milestone: | R1 |
Component: | - General | Version: | R1/pre-alpha1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | x86 |
Description
I encountered the following code snippet in Mono:
ret = pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
FreeBSD and NetBSD were special-cased to use 65536 instead.
No idea how standard this is, but maybe we should define it to something sensible?
Change History (4)
follow-up: 3 comment:1 by , 16 years ago
Priority: | normal → low |
---|
comment:2 by , 16 years ago
FYI in this particular case, using 4096 in place of PTHREAD_STACK_MIN
badly freezes the system. Same for 8192 (seen on OSX in limits.h
). Using 65536 doesn't.
vm_page_fault: vm_soft_fault returned error 'Bad address' on fault at 0x70002007 create_thread: unable to create proper user stack! CPU 0 halted!
comment:3 by , 16 years ago
Replying to bonefish:
PTHREAD_STACK_MIN
is not part of the POSIX standard (at least it's not supposed to be defined in <pthread.h> or <unistd.h>), and I wouldn't even know what kind of value it is supposed to
PTHREAD_STACK_MIN should be defined in limits.h.
Our pthread_attr_setstacksize() checks against MIN_USER_STACK_SIZE whereas it should be PTHREAD_STACK_MIN.
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in hrev26982. If the value of PTHREAD_STACK_MIN is problematic, please yell :-)
PTHREAD_STACK_MIN
is not part of the POSIX standard (at least it's not supposed to be defined in <pthread.h> or <unistd.h>), and I wouldn't even know what kind of value it is supposed to have. The minimal stack is one page (4 KB), which is probably even sufficient for all libroot functions (that is ATM I can't think of any that would use more).