X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fdataslot.cs;h=15280af496dd884f6821fa2a76f8743892cf0ea7;hb=1288c84cd73c2aac7bc61f4eeb55c6e08c04c29d;hp=437a137727f3bf9240e3a8982f6415eca1490da8;hpb=0abc2e6270020edc4a5b4c66f93b4ae582815f20;p=mono.git diff --git a/mono/tests/dataslot.cs b/mono/tests/dataslot.cs index 437a137727f..15280af496d 100644 --- a/mono/tests/dataslot.cs +++ b/mono/tests/dataslot.cs @@ -2,7 +2,7 @@ using System; using System.Threading; -public class Test { +public class Test : MarshalByRefObject { static LocalDataStoreSlot[] slot = new LocalDataStoreSlot[102400]; private void Thread_func() { @@ -27,6 +27,19 @@ public class Test { Console.WriteLine("slot 96801 contains " + Thread.GetData(slot[96801])); } + static LocalDataStoreSlot slot2; + static string slot_value; + + public void Foo (AppDomain ad) + { + ad.DoCallBack (new CrossAppDomainDelegate (Bar)); + } + + public static void Bar () + { + slot_value = (string)Thread.GetData (slot2); + } + public static int Main () { Console.WriteLine ("Hello, World!"); Test test=new Test(); @@ -48,6 +61,18 @@ public class Test { Console.WriteLine("slot 26801 contains " + Thread.GetData(slot[26801])); Console.WriteLine("slot 76801 contains " + Thread.GetData(slot[76801])); + // Test appdomain transitions + AppDomain ad = AppDomain.CreateDomain ("MyFriendlyDomain"); + Test o = (Test) ad.CreateInstanceFromAndUnwrap ("dataslot.exe", "Test"); + + slot2 = Thread.AllocateDataSlot (); + Thread.SetData (slot2, "hello"); + + o.Foo (AppDomain.CurrentDomain); + + if (Test.slot_value != "hello") + return 1; + return 0; } }