From: "kosaki (Motohiro KOSAKI)" Date: 2012-09-30T00:47:56+09:00 Subject: [ruby-core:47737] [ruby-trunk - Bug #7086] ConditionVariable#wait has meaningless return value Issue #7086 has been updated by kosaki (Motohiro KOSAKI). I think Java API spec is crazy and buggy. It explicitly says: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Condition.html#await(long,%20java.util.concurrent.TimeUnit) > When waiting upon a Condition, a "spurious wakeup" is permitted to occur, in general, as a concession to > the underlying platform semantics. And then, no timeout doesn't mean the condition become true and an API user always have to ignore the return value and check his own condition again. Moreover, we have one another mess. When cv#signal was not only fired but also timeout occur, some OS return timeout occur and other return cv#signal received. Both POSIX and Java permit such platform dependency. then, you must not trust the return value. I'm hesitate to implement it because it seems bring a lot of trouble than worth. ---------------------------------------- Bug #7086: ConditionVariable#wait has meaningless return value https://bugs.ruby-lang.org/issues/7086#change-29792 Author: rklemme (Robert Klemme) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20) [i686-linux] I consider this an API bug: when invoked with a timeout value the caller cannot distinguish from the return value whether the condition has been signaled or the time has run out. Consider how Java does it: http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Condition.html#await(long,%20java.util.concurrent.TimeUnit) and http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Condition.html#awaitUntil(java.util.Date) There's another issue exhibited through the script but I will create a separate ticket for this. -- http://bugs.ruby-lang.org/