Lee Noar wrote:
Yes, 2.0.0.12-riscpc does work on my machine, and I see that Firefox
uses pthread_yield() quite extensively. Whatever triggers this bug must
be fairly rare as it doesn't always fail. I don't see how it could be
specific to shared library code as it really isn't any different to
non-PIC code as far as the CPU is concerned
Well, more to the mystery. I'm pretty sure I have your change -
although TBH it's sometimes a bit hard to tell with our build
setup :-(
I'm looking for problems with pthread conditions, which is
afflicting nspr. Anyway, using the program below, it dies
in __pthread_yield_return, looks like after the sleep call returns:
-----
wait
Fatal signal received: Quit
Stack backtrace:
Running thread 0x3e980
( a7f4c) pc: 5c860c90 lr: 5c86123c sp: a7f50 ?()
( a7ff4) pc: 5c860d94 lr: 5c861834 sp: a7ff8 ?()
Thread 0xdb18
( a7f28) pc: 5c7fcbb8 lr: 5c7fa714 sp: a6f58
__pthread_yield_return()
( a6f68) pc: 5c7fcb18 lr: 5c7fa714 sp: a6f6c pthread_yield()
( a6fa0) pc: 5c7fa5d4 lr: 877c sp: a6fa4 ?()
( a6fc8) pc: 8704 lr: 87e0 sp: a6fcc ?()
( a6fe0) pc: 87b8 lr: 5c7eef04 sp: a6fe4 ?()
( a6ff4) pc: 5c7eeeac lr: 5c8ac0b0 sp: a6ff8 ?()
-----
But only outside the desktop, not in a taskwindow, and it goes away
if it's static. This is RISC OS 5 of course.
------------
#include <stdio.h>
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
static void *thread_loop(void *unused)
{
while (1) {
sleep(1);
puts("loop");
}
return NULL;
}
void waittest(void) {
struct timeval now;
struct timespec timeout;
int retcode;
pthread_mutex_lock(&mut);
gettimeofday(&now, NULL);
timeout.tv_sec = now.tv_sec + 5;
timeout.tv_nsec = now.tv_usec * 1000;
retcode = 0;
puts("wait");
retcode = pthread_cond_timedwait(&cond, &mut, &timeout);
printf("done: %d\n", retcode);
pthread_mutex_unlock(&mut);
}
int main(void) {
pthread_t thread;
pthread_create(&thread, NULL, thread_loop, NULL);
waittest();
return 0;
}
------------
_______________________________________________
GCCSDK mailing list [email protected]
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK