コード例 #1
0
        public void Enqueue(ServiceRequest req)
        {
            // For now disable interrupts:
            bool iflag = Processor.DisableInterrupts();

            spinLock.Acquire();
            try {
                if (head == null)
                {
                    head = req;
                    tail = req;
                }
                else
                {
                    tail.next = req;
                    tail      = req;
                }
            }
            finally {
                spinLock.Release();
            }

            // Signal an event : for now it is possible that it can be spirous one...
            enqueueEvent.InterruptAwareSet();

            // Reenable interrupts
            Processor.RestoreInterrupts(iflag);
        }
コード例 #2
0
        private static bool Lock()
        {
            bool enabled = Processor.DisableInterrupts();

#if SINGULARITY_MP
            rangeLock.Acquire(Thread.CurrentThread);
#endif // SINGULARITY_MP
            return(enabled);
        }
コード例 #3
0
        static internal unsafe void AddProcessorContext(ProcessorContext *context)
        {
            // Add processor to list of processors in MP system.  Careful
            // to avoid adding processor mid-freeze or without lock.
start:
            freezeLock.Acquire();
            try {
                if (FreezeRequested)
                {
                    goto start;
                }
                ProcessorContext *head = Processor.processorTable[0].context;

                context->nextProcessorContext = head->nextProcessorContext;
                head->nextProcessorContext    = context;
                context->ipiFreeze            = Running;
                // From this point on the processor is visible
                // in the debugger
                DebugStub.AddProcessor(context->cpuRecord.id);
            }
            finally {
                freezeLock.Release();
            }
        }
コード例 #4
0
        // Create a log entry for the allocation that just occurred on this thread.
        protected override void Allocation(UIntPtr objAddr, Type type, UIntPtr size)
        {
            bool iflag;

            // We cannot recurse inside an Allocation notification, or we will simply
            // blow the stack on the first entry.  Also, we don't want to log allocations
            // that occur as a consequence of logging the state of the GC heap -- though
            // we could support that if we chose to.

            if (enabled &&
                recurseThread != Thread.CurrentThread &&            // recurse?
                Buffer.OwningThread != Thread.CurrentThread)        // GC logging?

            {
                iflag = Processor.DisableLocalPreemption();
                allocationLock.Acquire();

                try {
                    DebugStub.Assert(recurseThread == null);
                    recurseThread = Thread.CurrentThread;

                    Buffer.LogTick();

                    uint stackSize = Isa.GetStackReturnAddresses(stackEips);
                    uint stkNo     = 0;

                    if (stackSize > 0)
                    {
                        stkNo = GetStackId(type, size, stackEips, stackSize);
                    }

                    ProfilerBuffer.LogAllocation(Thread.CurrentThread.GetThreadId(), objAddr, stkNo);
                }
                finally {
                    recurseThread = null;
                    allocationLock.Release();
                    Processor.RestoreLocalPreemption(iflag);
                }
            }
        }
コード例 #5
0
ファイル: RTClock.cs プロジェクト: Paul1nh0/Singularity
 private void AcquireLock()
 {
     rtcSpinLock.Acquire();
 }