Re: The perl 5.10.0 headache
Hi from GNU/kFreeBSD porter.
After talking it over with stephen and arranging perl 5.10 to be built on
real metal vs aranym, we are pleased to report that perl passes its test
suite with the exception of one test, a threading stress test which
launchs multiple threads, and then tries to make sure that they close in
It appears its caused by the antique version of glibc we use, and the
fact that we are using the old linuxthreads package vs. nptl.
The test passes even under linuxthreads, but real-time variant of
signals have to be used, i.e. they should properly queue in kernel.
I know it, because on GNU/kFreeBSD it needs 7.x kernel.
You can use attached code to perform the same test in C.
Problem would be rather missing memory barier, or non-atomic operation.
This should be fixable even with 2.5 glibc and linuxthreads.
pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
void * job(void * arg)
int a = (int) arg;
struct timeval now;
struct timespec timeout;
printf("Started %d\n", a);
usleep((rand() % 32777));
while (x != a)
printf("wait %d %d\n", x, a);
timeout.tv_sec = now.tv_sec + 1;
timeout.tv_nsec = now.tv_usec * 1000;
retcode = pthread_cond_timedwait(&cond, &mut, &timeout);
if (retcode == ETIMEDOUT)
printf("Timeout %d\n", a);
printf("exit a %d %d\n", x, a);
printf("exit b %d %d\n", x, a);
printf("exit c %d %d\n", x, a);
for (i = 0; i < 50; i++)
pthread_create(&t, NULL, job, (void *) i);
printf("FINAL %d %d\n", x, i);