add: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/thread/exclusive_tags.txt
File: exclusive_tags.txt
===================================================================
--- [no source file]
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/ironruby-tags/library/thread/exclusive_tags.txt;exc
@@ -1,0 +1,1 @@
+fails:Thread.exclusive should raise LocalJumpError if no block is given
===================================================================
add: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/library/shell/commandprocessor/echo_spec.rb
File: echo_spec.rb
===================================================================
--- [no source file]
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/library/shell/commandprocessor/echo_spec.rb;exc
@@ -1,0 +1,14 @@
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+require 'shell'
+
+describe "Shell::CommandProcessor#echo" do
+  before :each do
+    sh = Shell.new
+    @cmd = sh.instance_variable_get("@command_processor")
+  end
+  
+  it "returns a Shell::Echo" do
+    @cmd.echo("Hello").should be_kind_of(Shell::Echo)
+  end
+end
===================================================================
add: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/library/thread/exclusive_spec.rb
File: exclusive_spec.rb
===================================================================
--- [no source file]
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/mspec/rubyspec/library/thread/exclusive_spec.rb;exc
@@ -1,0 +1,27 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require 'thread'
+
+describe "Thread.exclusive" do
+  it "should implement a critical region" do
+    counter = 0
+    threads = []
+    10.times { threads << Thread.new { 1000.times { Thread.exclusive { counter += 1 } } } }
+    threads.each { |t| t.join }
+    counter.should == (10 * 1000)
+  end
+  
+  it "allows break" do
+    result = Thread.exclusive { break 100 }
+    result.should == 100
+    Thread.critical.should be_false
+  end
+
+  it "propagates the block return value" do
+    result = Thread.exclusive { 100 }
+    result.should == 100
+  end  
+
+  it "should raise LocalJumpError if no block is given" do
+    lambda { Thread.exclusive }.should raise_error(LocalJumpError)
+  end
+end
\ No newline at end of file
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;C1221149
File: Initializers.Generated.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;C1221149  (server)    10/20/2009 11:32 PM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs;exc
@@ -6519,6 +6519,7 @@
             DefineGlobalClass("ConditionVariable", typeof(IronRuby.StandardLibrary.Threading.RubyConditionVariable), 0x00000100, classRef0, LoadConditionVariable_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
             DefineGlobalClass("Mutex", typeof(IronRuby.StandardLibrary.Threading.RubyMutex), 0x00000100, classRef0, LoadMutex_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
             IronRuby.Builtins.RubyClass def1 = DefineGlobalClass("Queue", typeof(IronRuby.StandardLibrary.Threading.RubyQueue), 0x00000100, classRef0, LoadQueue_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
+            DefineGlobalClass("Thread", typeof(System.Threading.Thread), 0x00000000, classRef0, null, LoadThread_Class, null, IronRuby.Builtins.RubyModule.EmptyArray);
             DefineGlobalClass("SizedQueue", typeof(IronRuby.StandardLibrary.Threading.SizedQueue), 0x00000100, def1, LoadSizedQueue_Instance, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
         }
         
@@ -6650,6 +6651,13 @@
             
         }
         
+        private static void LoadThread_Class(IronRuby.Builtins.RubyModule/*!*/ module) {
+            DefineLibraryMethod(module, "exclusive", 0x21, 
+                new Func<IronRuby.Runtime.RubyContext, IronRuby.Runtime.BlockParam, System.Object, System.Object>(IronRuby.StandardLibrary.Threading.ThreadOps.Exclusive)
+            );
+            
+        }
+        
     }
 }
 
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/IronRuby.Libraries.Build.csproj;C1215621
File: IronRuby.Libraries.Build.csproj
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/IronRuby.Libraries.Build.csproj;C1215621  (server)    10/21/2009 12:14 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/IronRuby.Libraries.Build.csproj;exc
@@ -196,6 +196,7 @@
       <Compile Include="Thread\RubyMutex.cs" />
       <Compile Include="Thread\RubyQueue.cs" />
       <Compile Include="Thread\SizedQueue.cs" />
+      <Compile Include="Thread\Thread.cs" />
     </ItemGroup>
     <ItemGroup>
       <!--                            -->
===================================================================
edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ThreadOps.cs;C1162930
File: ThreadOps.cs
===================================================================
--- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ThreadOps.cs;C1162930  (server)    10/21/2009 10:44 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/ThreadOps.cs;exc
@@ -737,3 +737,27 @@
         }
     }
 }
+
+namespace IronRuby.StandardLibrary.Threading {
+    /// <summary>
+    /// These methods are loaded only after doing "require 'thread'"
+    /// </summary>
+    [RubyClass("Thread", Extends = typeof(Thread), Inherits = typeof(object))]
+    public static class ThreadOps {
+        [RubyMethod("exclusive", RubyMethodAttributes.PublicSingleton)]
+        public static object Exclusive(RubyContext/*!*/ context, [NotNull]BlockParam /*!*/block, object self) {
+            System.Diagnostics.Debug.Assert(!IronRuby.Builtins.ThreadOps.Critical(context, self), 
+                "IronRuby does not support nested calls to Thread.critical= because it uses native threads, not green threads");
+            IronRuby.Builtins.ThreadOps.Critical(context, self, true);
+            try {
+                object result = null;
+                if (block.Yield(out result)) {
+                    return block.Break(result);
+                }
+                return result;
+            } finally {
+                IronRuby.Builtins.ThreadOps.Critical(context, self, false);
+            }
+        }
+    }
+}
===================================================================
