Ejemplo n.º 1
0
 internal static void SetCurrentThreadCausalities(CausalityThreadContext context)
 {
     if (!Dispatcher._causalitiesActive)
     {
         return;
     }
     try
     {
         Dispatcher._causalityTable[Thread.CurrentThread.ManagedThreadId] = context;
     }
     catch (Exception)
     {
         if (!Dispatcher._causalityTable.ContainsKey(Thread.CurrentThread.ManagedThreadId))
         {
             try
             {
                 Dispatcher.AddThread(Thread.CurrentThread);
                 Dispatcher._causalityTable[Thread.CurrentThread.ManagedThreadId] = context;
             }
             catch
             {
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void StartWorkers()
        {
            DateTime now = DateTime.Now;

            foreach (TaskExecutionWorker current in _taskExecutionWorkers)
            {
                current._thread.Start();
            }
            _startupCompleteEvent.WaitOne();
            if ((_options & DispatcherOptions.UseProcessorAffinity) > DispatcherOptions.None)
            {
                Dispatcher.SetWorkerThreadAffinity(now);
            }
            _startupCompleteEvent.Close();
            _startupCompleteEvent = null;
            foreach (TaskExecutionWorker current2 in _taskExecutionWorkers)
            {
                Dispatcher.AddThread(current2._thread);
            }
        }