Exemplo n.º 1
0
        private void ResolveThreadStartAddress(int tid, ulong startAddress)
        {
            ResolveMessage result = new ResolveMessage
            {
                Tid = tid
            };


            _moduleLoadCompletedEvent.Wait();

            if (_symbols == null)
            {
                return;
            }

            try
            {
                Interlocked.Increment(ref _loading);

                if (this.LoadingStateChanged != null)
                {
                    this.LoadingStateChanged(Thread.VolatileRead(ref _loading) > 0);
                }

                try
                {
                    SymbolFlags flags;
                    string      fileName;

                    result.Symbol = _symbols.GetSymbolFromAddress(
                        startAddress,
                        out result.ResolveLevel,
                        out flags,
                        out fileName
                        );
                    result.FileName = fileName;
                    _messageQueue.Enqueue(result);
                }
                catch
                { }
            }
            finally
            {
                Interlocked.Decrement(ref _loading);

                if (this.LoadingStateChanged != null)
                {
                    this.LoadingStateChanged(Thread.VolatileRead(ref _loading) > 0);
                }
            }
        }
Exemplo n.º 2
0
        protected override bool WaitOneInternal(int timeout)
        {
#if USE_FAST_EVENT
            if (m_isClosed)
#else
            if (m_gate == null)
#endif
            { throw new ObjectDisposedException("Semaphore already closed"); }

            if (timeout < Timeout.Infinite)
            {
                throw new ArgumentOutOfRangeException("timeout", "timeout must be >= 0");
            }

            if (!m_gate.Wait(timeout))              // try to enter and close gate
            {
                return(false);
            }

            if (Interlocked.Decrement(ref m_currentCount) > 0)
            {
                m_gate.Set();
            }

            return(true);
        }
Exemplo n.º 3
0
            public WaiterThread(Waiter owner)
            {
                _owner = owner;

                // Create the waiter thread.
                _thread = new Thread(this.WaiterThreadStart, ProcessHacker.Common.Utils.SixteenthStackSize);
                _thread.IsBackground = true;
                _thread.SetApartmentState(ApartmentState.STA);
                _thread.Start();

                // Wait for the thread to initialize.
                _threadInitializedEvent.Wait();
            }
Exemplo n.º 4
0
        public ProviderThread(int interval)
        {
            LinkedList.InitializeListHead(_listHead);

            _timerHandle  = TimerHandle.Create(TimerAccess.All, TimerType.SynchronizationTimer);
            this.Interval = interval;

            _thread = new Thread(new ThreadStart(this.Update), ProcessHacker.Common.Utils.QuarterStackSize);
            _thread.IsBackground = true;
            _thread.SetApartmentState(ApartmentState.STA);
            _thread.Start();
            _thread.Priority = ThreadPriority.Lowest;
            _initializedEvent.Wait();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Waits for the work item to be completed.
 /// </summary>
 /// <param name="timeout">The timeout for the wait operation.</param>
 /// <returns>
 /// True if the work item was completed within the timeout
 /// (or was already completed); otherwise false.
 /// </returns>
 public bool WaitOne(int timeout)
 {
     return(_completedEvent.Wait(timeout));
 }