Beispiel #1
0
        public Thread(ParameterizedThreadStart start)
        {
            if (start == null)
            {
                throw new ArgumentNullException(nameof(start));
            }

            _runtimeThread = RuntimeThread.Create(ThreadMain_ParameterizedThreadStart);
            Debug.Assert(_runtimeThread != null);
            _start = start;
        }
        internal RuntimeEvaluation(RuntimeThread thread, ICorDebugEval comEvaluation)
        {
            if (thread.State == ThreadState.Suspended)
                throw new InvalidOperationException("Thread is suspended.");
            if (!thread.IsManaged)
                throw new InvalidOperationException("Thread is at native code.");
            if (!thread.IsAtGCSafePoint) 
                throw new InvalidOperationException("Thread is at GC unsafe point.");

            _thread = thread;
            _comEvaluation = comEvaluation;
        }
Beispiel #3
0
        public Thread(ThreadStart start, int maxStackSize)
        {
            if (start == null)
            {
                throw new ArgumentNullException(nameof(start));
            }
            if (maxStackSize < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxStackSize), SR.ArgumentOutOfRange_NeedNonnegativeNumber);
            }

            _runtimeThread = RuntimeThread.Create(ThreadMain_ThreadStart, maxStackSize);
            Debug.Assert(_runtimeThread != null);
            _start = start;
        }
Beispiel #4
0
 private Thread(RuntimeThread runtimeThread)
 {
     Debug.Assert(runtimeThread != null);
     _runtimeThread = runtimeThread;
 }
Beispiel #5
0
 public static void RestoreReentrantWaits()
 {
     RuntimeThread.RestoreReentrantWaits();
 }
Beispiel #6
0
 public static void SuppressReentrantWaits()
 {
     RuntimeThread.SuppressReentrantWaits();
 }
 public static void DoInitialize()
 {
     // Make sure that the finalizer thread is CoInitialized before any objects are finalized.  If this
     // fails, it will throw an exception and that will go unhandled, triggering a FailFast.
     RuntimeThread.InitializeCom();
 }
 public static RuntimeValue InvokeMethod(RuntimeThread thread, RuntimeFunction function, params RuntimeValue[] arguments)
 {
     var evaluation = thread.CreateEvaluation();
     evaluation.Call(function, arguments);
     if (!evaluation.WaitForResult(3000))
         return null;
     return evaluation.Result;
 }
 public static RuntimeValue InvokeMethod(RuntimeThread thread, int functionToken, params RuntimeValue[] arguments)
 {
     var resolvedModule = thread.Session.AssemblyResolver.ResolveModule(thread.CurrentFrame.Function.Module.Name);
     if (resolvedModule != null)
     {
         var resolvedMember = resolvedModule.ResolveMember(functionToken);
         if (resolvedModule != null)
             return InvokeMethod(thread, thread.CurrentFrame.Function.Module.GetFunction(unchecked((uint)resolvedMember.MetaDataToken)), arguments);
     }
     return null;
 }
 public static RuntimeValue InvokeMethod(RuntimeThread thread, SymbolToken functionToken, params RuntimeValue[] arguments)
 {
     return InvokeMethod(thread, functionToken.GetToken(), arguments);
 }