Ejemplo n.º 1
0
 public void SetCompressedStack(System.Threading.CompressedStack stack)
 {
 }
Ejemplo n.º 2
0
 public static void Run(System.Threading.CompressedStack compressedStack, System.Threading.ContextCallback callback, object state)
 {
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Normalize the itinerary
        /// </summary>
        void UniversalEntryPoint()
        {
            goto Started;
            Started : Started = System.DateTimeOffset.UtcNow; goto Aft;
Aft:
            System.Tuple <System.Action, ThreadPriorityInformation, System.TimeSpan> Item;
Begin:
            try
            {
                try
                {
                    while (Common.IDisposedExtensions.IsNullOrDisposed(this).Equals(false) &&
                           Itinerarius.Count > 0 &&
                           UpdateTokenSource.IsCancellationRequested.Equals(false))
                    {
                        if (Itinerarius.TryDequeue(out Item))
                        {
                            UnderlyingThread.Priority = System.Threading.ThreadPriority.Lowest;

                            //Todo, execution time will require Timer or Clock.

                            try { Item.Item1.Invoke(); }
                            catch { throw; }
                            finally { UnderlyingThread.Priority = System.Threading.ThreadPriority.Highest; }
                        }
                    }

                    //Depleted
                    UnderlyingThreadsPriorityInformation.SetIdle(UnderlyingThread);
                }
                catch (System.Exception)
                {
                    UnderlyingThread.Priority = System.Threading.ThreadPriority.Normal;

                    if (object.ReferenceEquals(ExceptionHandler, null).Equals(false))
                    {
                        UnderlyingCompressedStack = System.Threading.CompressedStack.Capture();

                        using (var enumerator = Exceptions.GetExceptions())
                        {
                            while (enumerator.MoveNext() && UpdateTokenSource.IsCancellationRequested.Equals(false))
                            {
                                UnderlyingThread.Priority = System.Threading.ThreadPriority.BelowNormal;

                                throw enumerator.Current;
                            }
                        }
                    }

                    goto Begin;
                }
            }
            catch (System.Exception ex)
            {
                UnderlyingThread.Priority = System.Threading.ThreadPriority.BelowNormal;

                if (Exceptions.Handle(ex).Equals(false))
                {
                    UnderlyingThread.Priority = System.Threading.ThreadPriority.Normal;

                    throw ex;
                }

                UnderlyingThread.Priority = System.Threading.ThreadPriority.AboveNormal;

                UnderlyingCompressedStack = null;
            }
            //finally
            //{
            //    unsafe { System.Runtime.InteropServices.Marshal.DestroyStructure(Unsafe.AddressOf(ref Item), StructureType); }
            //}

            //Wait for more work.
            if (object.ReferenceEquals(System.Threading.Thread.CurrentThread, UnderlyingThread))
            {
                System.Threading.Thread.Sleep(System.Threading.Timeout.InfiniteTimeSpan);

                goto Begin;
            }
        }