[Pkg-gauche-devel] hppa instability

NIIBE Yutaka gniibe at fsij.org
Wed Mar 24 06:04:15 UTC 2010


NIIBE Yutaka wrote:
> It found that tests at ext/threads faild.  It sometimes segfaults,
> sometimes just runs forever.
>
> Here is the case it runs forever.
>
> We need to check libc / ntpl implementation, I think.

Narrowed down to GCC implementation problem.

Here is a test program.

$ gcc -fexceptions -pthread test-pthread-cancel.c
$ ./a.out

On hppa, we don't see any output (should see clean2 and clean1).
The issue is that unwinding seems not working for -fexceptions.
BDWgc used -fexceptions.

-------------------------- test-pthread-cancel.c
#include <pthread.h>
#include <time.h>
#include <stdio.h>

static void *
clean1(void *arg)
{
  puts ("clean1");
}

static void *
clean2(void *arg)
{
  puts ("clean2");
}

static void
f1(void)
{
  struct timespec t;
  t.tv_sec = 0;
  t.tv_nsec = 1000;

  pthread_cleanup_push (clean2, NULL);

  while (1)
    nanosleep (&t, NULL);

  pthread_cleanup_pop(1);
}

static void *
f (void *arg)
{
  pthread_cleanup_push (clean1, NULL);

  f1();

  pthread_cleanup_pop(1);
}


int
main (int argc, char argv[])
{
  struct timespec t;
  t.tv_sec = 0;
  t.tv_nsec = 10000;

  pthread_t tid;
  pthread_create (&tid, NULL, f, NULL);

  nanosleep (&t, NULL);
  pthread_cancel (tid);
  pthread_join (tid, NULL);
}
--------------------------



More information about the Pkg-gauche-devel mailing list