After running your application in gdb, does it give you messages
[new process 123 ...]
Your application actually fork off threads, just linking against -lpthreads does nothing.
Check out http://www.mhpcc.edu/training/worksh...amples/hello.c
modify it a bit for the threads to stick around (sleep print loop or whatever) so you
have something to debug. after compiling it with gcc -o phello hello.c -lphtreads -g
you can load it into gdb with 'gdb phello', set breakpoints in the subthread and
don't forget to have a sleep in the main loop so it does not quit right away before
the threads get to execute.
(gdb) info threads
25 int main()
27 pthread_t threads[NUM_THREADS];
28 int rc, t;
(gdb) b 20
Breakpoint 1 at 0x80484bc: file h.c, line 20.
Starting program: /tmp/bonnie++-1.03a/h
[Thread debugging using libthread_db enabled]
[New Thread -1208814144 (LWP 29534)]
Creating thread 0
[New Thread -1208816720 (LWP 29537)]
Creating thread 1
0: Hello World!
[New Thread -1219306576 (LWP 29538)]
Creating thread 2
1: Hello World!
[New Thread -1229796432 (LWP 29539)]
Creating thread 3
[Switching to Thread -1219306576 (LWP 29538)]
Breakpoint 1, PrintHello (threadid=0x1) at h.c:20