# Code Review: IronRuby Thread fixes

**URL:** <https://www.ruby-forum.com/t/code-review-ironruby-thread-fixes/155799>\
**Category:** IronRuby\
**Created:** [December 16, 2008, 11:44pm UTC](https://www.ruby-forum.com/t/code-review-ironruby-thread-fixes/155799 "2008-12-16T23:44:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [December 16, 2008, 11:44pm UTC](https://www.ruby-forum.com/t/code-review-ironruby-thread-fixes/155799/1 "2008-12-16T23:44:35Z")

</div>

Affects: Microsoft.Scripting.Core.dll and IronRuby

tfpt review “/shelveset:Thread;REDMOND\sborde”

Comment :

Fixes to all the currently disabled Thread tests

Thread#stop/Kernel#sleep use an Event which can be signalled from  
other threads, instead of using Thread.Sleep

ThreadOps.CreateThread catches and ignores ThreadAbortException  
instead of publishing it as RubyThreadInfo.Exception

Thread#main - its per ScriptRuntime, mainly because that was easier to  
implement, and also there is no good answer to how Thread#main should  
function in hosted scenarios

Adds lock to RubyModule.EnsureInitialized to prevent use of  
uninitialized modules in multi-thread scenarios.

Changes RunRSpec.cmd to match the flags used by “rake why\_regression”

Microsoft.Scripting.Core:

Fixes ExpressionWriter to deal with GotoExpression.Value being null in  
VisitGoto

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [December 17, 2008, 12:44am UTC](https://www.ruby-forum.com/t/code-review-ironruby-thread-fixes/155799/2 "2008-12-17T00:44:54Z")

</div>

Test changes look good. I’d like to see the RunRSpec.cmd use ruby to run  
mspec with args of ci and -t “path to ir”, which is what the rakefile  
sets up as a command line.

JD

From: Shri B.  
Sent: Tuesday, December 16, 2008 2:39 PM  
To: IronRuby External Code R.; Rowan Code R.; DLR Code  
Reviews  
Cc: removed\_email\_address@domain.invalid  
Subject: Code Review: IronRuby Thread fixes

Affects: Microsoft.Scripting.Core.dll and IronRuby

tfpt review “/shelveset:Thread;REDMOND\sborde”

Comment :

Fixes to all the currently disabled Thread tests

Thread#stop/Kernel#sleep use an Event which can be signalled from  
other threads, instead of using Thread.Sleep

ThreadOps.CreateThread catches and ignores ThreadAbortException  
instead of publishing it as RubyThreadInfo.Exception

Thread#main - its per ScriptRuntime, mainly because that was easier to  
implement, and also there is no good answer to how Thread#main should  
function in hosted scenarios

Adds lock to RubyModule.EnsureInitialized to prevent use of  
uninitialized modules in multi-thread scenarios.

Changes RunRSpec.cmd to match the flags used by “rake why\_regression”

Microsoft.Scripting.Core:

Fixes ExpressionWriter to deal with GotoExpression.Value being null in  
VisitGoto

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [December 17, 2008, 1:22am UTC](https://www.ruby-forum.com/t/code-review-ironruby-thread-fixes/155799/3 "2008-12-17T01:22:56Z")

</div>

DLR change looks great!

From: Shri B.  
Sent: Tuesday, December 16, 2008 2:39 PM  
To: IronRuby External Code R.; Rowan Code R.; DLR Code  
Reviews  
Cc: removed\_email\_address@domain.invalid  
Subject: Code Review: IronRuby Thread fixes

Affects: Microsoft.Scripting.Core.dll and IronRuby

tfpt review “/shelveset:Thread;REDMOND\sborde”

Comment :

Fixes to all the currently disabled Thread tests

Thread#stop/Kernel#sleep use an Event which can be signalled from  
other threads, instead of using Thread.Sleep

ThreadOps.CreateThread catches and ignores ThreadAbortException  
instead of publishing it as RubyThreadInfo.Exception

Thread#main - its per ScriptRuntime, mainly because that was easier to  
implement, and also there is no good answer to how Thread#main should  
function in hosted scenarios

Adds lock to RubyModule.EnsureInitialized to prevent use of  
uninitialized modules in multi-thread scenarios.

Changes RunRSpec.cmd to match the flags used by “rake why\_regression”

Microsoft.Scripting.Core:

Fixes ExpressionWriter to deal with GotoExpression.Value being null in  
VisitGoto

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [December 17, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/code-review-ironruby-thread-fixes/155799/4 "2008-12-17T17:42:58Z")

</div>

Ruby changes are good.

From: Shri B.  
Sent: Tuesday, December 16, 2008 2:39 PM  
To: IronRuby External Code R.; Rowan Code R.; DLR Code  
Reviews  
Cc: removed\_email\_address@domain.invalid  
Subject: Code Review: IronRuby Thread fixes

Affects: Microsoft.Scripting.Core.dll and IronRuby

tfpt review “/shelveset:Thread;REDMOND\sborde”

Comment :

Fixes to all the currently disabled Thread tests

Thread#stop/Kernel#sleep use an Event which can be signalled from  
other threads, instead of using Thread.Sleep

ThreadOps.CreateThread catches and ignores ThreadAbortException  
instead of publishing it as RubyThreadInfo.Exception

Thread#main - its per ScriptRuntime, mainly because that was easier to  
implement, and also there is no good answer to how Thread#main should  
function in hosted scenarios

Adds lock to RubyModule.EnsureInitialized to prevent use of  
uninitialized modules in multi-thread scenarios.

Changes RunRSpec.cmd to match the flags used by “rake why\_regression”

Microsoft.Scripting.Core:

Fixes ExpressionWriter to deal with GotoExpression.Value being null in  
VisitGoto
