tags:

views:

47

answers:

2

I have a weird problem with my threaded software.

I start 2 instances of the software. Each instance has 2 threads, one thread creates a socket to use, and the other one is uses the socket for communication.

When one of the threads in one instance calls sleep(3), the other threads in the the other instance sleeps too. And the weirdest thing is that when I rebooted the computer, it works the first time, but after trying a second time, it sleeps like described.

How is this possible? Is it using some shared resource?

+2  A: 

Sleep suspends your process, not your thread. See sleep vs pthead_yield for more details.

Devon_C_Miller
But even so, why is it sleeping the other instance because they are different processes?
DeeD
Ah, sorry, misread the question. You'll need to give more details. Preferably a SSCCE (http://sscce.org).
Devon_C_Miller
A: 

Have you tried wrapping your sleep function in a prophylactic?

Rakis