gdb
[Top][All Lists]
Advanced

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

[Gdb] sigwait exits in gdb on pthread_exit call


From: linux
Subject: [Gdb] sigwait exits in gdb on pthread_exit call
Date: Sat, 26 Jun 2004 00:44:51 -0400
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

When I run a multithreaded program in the debugger, it exists on my sigwait call (EINTR) when a thread calls pthread_exit(NULL). If I change the call to a return 0, then the problem goes away. I don't have this problem if I don't run in gdb. I was able to recreate the problem with a very small program. To compile, I use g++ -g -O0 -o mymain mymain.cpp -lpthread -lrt

I am using gdb 6.1.1 - Red Hat Fedora Core 1 - Kernel 2.4.22-1.2115 with my setup. GCC 3.3.2

#include <signal.h>
#include <iostream>

void *MyThread(void *classInt)
{
  std::cout << "My thread runs\n";
  //If I replace with return 0; then the problem goes away
  pthread_exit(NULL);
}

int main(int argc,char *argv[])
{
  sigset_t set;
  int signum;
  int results;
  pthread_attr_t threadAttribute;
  pthread_t      threadId;
  struct sched_param param;

  sigemptyset(&set);
  sigaddset(&set,SIGINT);
  pthread_sigmask(SIG_BLOCK,&set,NULL);

  pthread_attr_init(&threadAttribute);
  pthread_attr_setschedpolicy(&threadAttribute,SCHED_RR);
  param.sched_priority = 50;
  pthread_attr_setschedparam(&threadAttribute,&param);
  pthread_create(&threadId,&threadAttribute,MyThread,0);

  signum = -1;
  results = 0;
  results = sigwait(&set,&signum);
std::cerr << "Interrupted " << results << " Signum = " << signum << std::endl;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]