From: Yusuke Endoh Date: 2012-04-16T22:07:10+09:00 Subject: [ruby-core:44388] Re: [ruby-trunk - Bug #6288] Change error message for thread block to be less misleading Hello, 2012/4/16 rklemme (Robert Klemme) : >> If so, you should write "sleep" simply. �If not, your code is >> actually "deadlocked", in a common sense. > > There is no deadlock because there are no two threads (or processes) accessing resources in a bad order. �I am not aware of any deadlock which can be caused by a single thread only. �If you find a definition of deadlock which needs only a single thread / action / process please let us know. > > "A deadlock is a situation wherein two or more competing actions are each waiting for the other to finish, and thus neither ever does." > http://en.wikipedia.org/wiki/Deadlock I see. But, what do you think about the following? m = Mutex.new m.lock m.lock #=> deadlock; recursive locking The article of wikipedia also says: "For non-recursive locks, a lock may be entered only once (where a single thread entering twice without unlocking will cause a deadlock..." The definition of "deadlock" is difficult :-) My informal definition of "deadlock" is, a situation where all threads are waiting for an action of other threads. For example, Thread.stop, Queue#pop, Mutex#lock, etc. may wait for other threads. If the only thread do so in a single threaded program, *all* threads are indeed waiting, which is a deadlock in my definition. Anyway, regardless of the definition, I think your message proposal is better than the current, so I'll change it. Thanks! -- Yusuke Endoh