# DLR hosting

**URL:** <https://www.ruby-forum.com/t/dlr-hosting/159020>\
**Category:** IronRuby\
**Created:** [January 30, 2009, 1:47pm UTC](https://www.ruby-forum.com/t/dlr-hosting/159020 "2009-01-30T13:47:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [January 30, 2009, 1:47pm UTC](https://www.ruby-forum.com/t/dlr-hosting/159020/1 "2009-01-30T13:47:46Z")

</div>

it will show that so far I’ve been working with instead of on IronRuby  
🙂  
And then I’ve been focussed on using the Ruby language and .NET from  
Ruby  
instead of using C# to host Ironruby.  
I’m using a debug build from IronRuby and the weird thing is that I have  
to  
add ClassHierarchyLocker.

```
        var controllerRubyClass =

```

ScriptRuntime.Globals.GetVariable(controllerRubyClassName);  
string controllerRubyMethodName = null;  
using (rubyContext.ClassHierarchyLocker())  
{  
controllerRubyClass.EnumerateMethods((\_, symbolId, \_\_)  
=\>  
{  
if  
(String.Equals(symbolId, actionName,

StringComparison.OrdinalIgnoreCase))  
{

controllerRubyMethodName = symbolId;  
return  
true;  
}  
return  
false;  
});  
}

The question I have here is: Why do I need the ClassHierarchyLocker ?

Cheers Ivan

---

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [January 30, 2009, 2:48pm UTC](https://www.ruby-forum.com/t/dlr-hosting/159020/2 "2009-01-30T14:48:19Z")

</div>

It’s part of Tomas’ thread-safety work. To enumerate the methods  
safely, you need to ensure that another thread isn’t modifying the  
method list.

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Ivan Porto  
Carrero  
Sent: Friday, January 30, 2009 4:47 AM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] DLR hosting

it will show that so far I’ve been working with instead of on IronRuby  
🙂 And then I’ve been focussed on using the Ruby language and .NET from  
Ruby instead of using C# to host Ironruby.

I’m using a debug build from IronRuby and the weird thing is that I have  
to add ClassHierarchyLocker.

```
        var controllerRubyClass = 

```

ScriptRuntime.Globals.GetVariable(controllerRubyClassName);  
string controllerRubyMethodName = null;  
using (rubyContext.ClassHierarchyLocker())  
{  
controllerRubyClass.EnumerateMethods((\_, symbolId, \_\_)  
=\>  
{  
if  
(String.Equals(symbolId, actionName,  
StringComparison.OrdinalIgnoreCase))  
{  
controllerRubyMethodName  
= symbolId;  
return  
true;  
}  
return  
false;  
});  
}

The question I have here is: Why do I need the ClassHierarchyLocker ?

Cheers Ivan
