コード例 #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);
                }
            }
        }
コード例 #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);
        }
コード例 #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();
            }
コード例 #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();
        }
コード例 #5
0
ファイル: WorkQueue.cs プロジェクト: wumn290/processhacker-3
 /// <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));
 }