[PATCH] thread_timeout: document additional caveats

Eric Wong normalperson at yhbt.net
Thu Jul 19 20:14:03 UTC 2012


Again, for the one thousandth time, timing out threads is very
tricky business :<
---
 Pushed to "master" of git://bogomips.org/rainbows and updated
 http://rainbows.rubyforge.org/Rainbows/ThreadTimeout.html

 lib/rainbows/thread_timeout.rb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/rainbows/thread_timeout.rb b/lib/rainbows/thread_timeout.rb
index 4f62aba..8348272 100644
--- a/lib/rainbows/thread_timeout.rb
+++ b/lib/rainbows/thread_timeout.rb
@@ -44,6 +44,15 @@
 # does not expose a monotonic clock for users, so don't change
 # the system time while this is running.  All servers should be
 # running ntpd anyways.
+#
+# "ensure" clauses may not fire properly or be interrupted during
+# execution, so do not mix this module with code which relies on "ensure".
+# (This is also true for the "Timeout" module in the Ruby standard library)
+#
+# "recursive locking" ThreadError exceptions may occur if
+# ThreadTimeout fires while a Mutex is locked (because "ensure"
+# clauses may not fire properly).
+
 class Rainbows::ThreadTimeout
 
   # :stopdoc:
-- 
Eric Wong


More information about the rainbows-talk mailing list