views:

63

answers:

5

A deadlock normally means that thread (or process) A is waiting for thread B, and at the same time thread B is waiting for thread A.

Currently I encountered a similar situation in our application. Thread A is waiting for an event to be set by thread B. However, thread B is not waiting for thread A, it just won't set the event (no matter for what reason). I am wondering whether this situation can also be called a "deadlock", or is there an other term for this?

+1  A: 

Yes - I would call this a deadlock, too.

However, only one thread (Thread A) is affected from it, not the entire application.

winSharp93
I'd say that A is halted, not deadlocked. But it's really semantic quibling.
anon
What Neil said. I'd say a deadlock is when two (or more) processes are waiting for **each other** to complete before they can proceed. Blocking (i.e. `Thread.Sleep(-1)`) indefinitely is not a deadlock.
Martinho Fernandes
Thank you. It seems I misunderstood the definition.
winSharp93
+5  A: 

I'd call it a bug or bad design. But it is not deadlock if one thread is still running.

anon
A: 

Here is my point of view :

A deadlock is a situation where the global state of the program does not progress anymore. If A is blocked but the program can still terminate because B may find a solution, it is not a deadlock.

Ben
*A deadlock is a situation where the global state of the program does not progress anymore.* :this definition would also fit the "livelock" case.
jldupont
Well hum ... yes. I was just trying to answer the question, the part you mentioned is a required condition to be a deadlock. And it is *not* fulfilled in the bytepusher's question. It doesn't mean everything that fullfilled this condition is a deadlock. Just like a car usually has 4 wheels, but all vehicles with 4 wheels are not necessarily cars ...(Ok I understand your point, I had to answer something)
Ben
+4  A: 

Strictly speaking, no that's not deadlock, which is what you initially said (except that in general there could be a whole cycle of threads each waiting for the next one's lock: A->B->...->Z->A).

I think you could call it resource starvation, but that's quite a general term that also covers deadlock.

Dave Turner
+3  A: 

I would call it a starvation (ressource being CPU), not a deadlock.

mouviciel