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

Bug#197988: pthread_cleanup_push broken on Alpha



Package: libc6.1
Version: 2.3.1-17
Severity: normal
File: /lib/libpthread.so.0

Running this program should print nikita and victor, but on Alpha, I
only get nikita:

falk@juist:/tmp% gcc test.c -lpthread && ./a.out 
Starting thread
Killing thread
Cleaner name <nikita>
End


#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void genericCleaner(void * name)
{
  printf("Cleaner name <%s>\n",(char*)name);
}
void * myThreadMain(void * Data)
{
  printf("Starting thread\n");
  if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL)!=0)      exit(-1);
  if (pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL)!=0) exit(-1);
  pthread_cleanup_push(genericCleaner,"victor");
  pthread_cleanup_push(genericCleaner,"nikita");
  while(1);
  pthread_cleanup_pop(1); //this point is never reached 
  pthread_cleanup_pop(1);  
  return NULL;
}
int main(void)
{
  pthread_t thread[1];
  if (pthread_create(&thread[0],NULL,myThreadMain,NULL)!=0)	exit(-1);
  sleep(1);
  printf("Killing thread\n");
  if (pthread_cancel(thread[0])!=0) exit(-1);
  if (pthread_join(thread[0],NULL)!=0) exit(-1);
  printf("End\n");
  return 0;
}


-- System Information:
Debian Release: testing/unstable
Architecture: alpha
Kernel: Linux juist 2.5.69 #3 Tue May 6 01:36:11 CEST 2003 alpha
Locale: LANG=C, LC_CTYPE=de_DE@euro

Versions of packages libc6.1 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information




Reply to: