I have an issue with pthread_join. Its in the classic sleeping barber
problem.
One thread per customer was created. When the last customer goes for a
hair cut, all the customer threads would have exited.
I have put the barber thread in while loop. The main thread after
generating the customers, waits for the customer threads to join and
then for the barber thread.
I assumed that the main thread should get blocked for ever as the
barber goes to sleep and wait for the next customer
but this is not what is happening.
the pthread_join for the barber thread returns a status of 3, which I
presume is a deadlock.
Can you help me with this
|
|
0
|
|
|
|
Reply
|
vinitha
|
2/29/2008 4:20:20 AM |
|
On Feb 29, 5:20=A0am, vinitha <vinivini...@gmail.com> wrote:
> the pthread_join for the barber thread returns a status of 3, which I
> presume is a deadlock.
In my errno.h file 3 is assigned to no such process:
#define ESRCH 3 /* No such process */
You should check the argument of the pthread_join call.
Best Regards,
Szabolcs
|
|
0
|
|
|
|
Reply
|
Szabolcs
|
2/29/2008 10:54:54 AM
|
|