Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

please try to reproduce weird problem with pthread_create and stacksize limit



Hi,

the following program:
--- snip ---
#include <pthread.h>
#include <stddef.h>

void *thread_routine(void *data) {
    return data;
}

int main() {
    pthread_t thd;
    pthread_mutexattr_t mattr;
    pthread_once_t once_init = PTHREAD_ONCE_INIT;
    int data = 1;
    pthread_mutexattr_init(&mattr);
    return pthread_create(&thd, NULL, thread_routine, &data);
}
--- snap ---

compiled by:
cc -o whatthehell -O2 -DNETBSD whatthehell.c -lm -lcrypt -lresolv -lpthread

will, when run and stacksize limit is 4089k or higher, yield on my Amiga:
8% ./whatthehell && echo ok
Abort (core dumped)

(and it'll take around two minutes and brake all processes on the machine
to a standstill when it does that)

gdb says to that:
#0  0x0808a746 in kill () from /usr/lib/libc.so.12
#1  0x080f183c in abort () from /usr/lib/libc.so.12
#2  0x0805d8de in pthread__sa_start () from /usr/lib/libpthread.so.0
#3  0x08060816 in pthread_init () from /usr/lib/libpthread.so.0
#4  0x08060bcc in pthread_create () from /usr/lib/libpthread.so.0
#5  0x00002910 in main ()
#6  0x00002650 in __start ()

If my stacksize limit is 4088k or less it just finishes 'immediately'
and I get an 'ok' printed from the echo as fast as I can discern.

Does anybody understand that? Can anybody else with NetBSD/amiga even
reproduce the behaviour (possibly with different limits)?

Tests on i386 and sparc64 didn't show the problem.

This happens on an Amiga 3000 with 68060, and 2.0.2_STABLE, but since that's
the resolution of PR pkg/27796 it's been happening at least since 2.0_RC1
(if it's a software problem and not just my hardware).

regards,
        spz
-- 
spz%serpens.de@localhost (S.P.Zeidler)



Home | Main Index | Thread Index | Old Index