Hello,
I have problems with debugging multi-threaded
application with dbg under Linux RedHat 6.2. The
below program runs perfectly well without gdb. Under
gdb (no breakpoints set) the
program terminates in either of the two assert()
statements - sleep() calls get interrupted. I'm
desperately
looking for the answer why.
I appreciate any help,
Slawek
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <assert.h>
void *
thread_routine(void *a)
{
unsigned int ret;
printf("Started\n");
ret = sleep(5);
assert(ret == 0); /* !!!!!!!!!!!!!!!!!!!!
HERE (ret is equal 5)
!!!!!!!!!!!!!!!!!!!!!!! */
printf("Stopped\n");
return NULL;
}
int
main(void)
{
pthread_t pid;
int i;
int ret;
/* we start with default attributes ... */
for (i = 0; i < 10; i++)
pthread_create(&pid, NULL, thread_routine, NULL);
ret = sleep(10);
assert(ret == 0); /* !!!!!!!!!!!!!!!!!!!!
HERE (ret is equal 10)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
return 0;
}
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb