require_relative '../../spec_helper' describe "Mutex#unlock" do it "raises ThreadError unless Mutex is locked" do mutex = Mutex.new -> { mutex.unlock }.should raise_error(ThreadError) end it "raises ThreadError unless thread owns Mutex" do mutex = Mutex.new wait = Mutex.new wait.lock th = Thread.new do mutex.lock wait.lock end # avoid race on mutex.lock Thread.pass until mutex.locked? Thread.pass until th.stop? -> { mutex.unlock }.should raise_error(ThreadError) wait.unlock th.join end it "raises ThreadError if previously locking thread is gone" do mutex = Mutex.new th = Thread.new do mutex.lock end th.join -> { mutex.unlock }.should raise_error(ThreadError) end end tion> The Ruby Programming Language
summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Expand)Author
2007-02-06 * string.c (rb_str_sub_bang): calling rb_str_modify() should be justusa
2007-01-31* removed svn:keywords for compatibility.shugo
2006-07-31* ruby.h: use ifdef (or defined) for macro constants that may ormatz
2006-07-26* string.c (rb_str_scan): add string modification check.matz
2006-07-11* string.c (rb_str_dump): need to extend len for \b.usa
2006-07-02* string.c (rb_str_inspect): encode \b (\010) for escape.matz
2006-06-27* string.c: RDoc update for =~ method. a patch from Alex Youngmatz
2006-05-16* re.c (rb_reg_initialize): should not modify untainted objects inmatz
2005-10-27* string.c (scan_once): wrong condition to use mbclen2().matz
2005-09-17* lib/cgi.rb (CGI::Cookie): should handle multiple values for amatz