Example #1
0
        internal static unsafe void SwitchToThreadContextNoGC(ref ThreadContext newContext)
        {
            // Interrupts should be disabled at this point
            VTable.Assert(Processor.InterruptsDisabled());

            // Save appears to returns twice: once with true on this thread after
            // the save, and once with false when the context is restored.

            if (GetCurrentThreadContext()->threadRecord.spill.Save())
            {
                // Initial return from save; time to swap in the new context.
                // Must do this on the interrupt stack, since once we release the
                // dispatch lock the saved context is free to run (and we would
                // be on the same stack.)
                fixed(ThreadContext *c = &newContext)
                {
                    // Note that this does not return.
                    Isa.CallbackOnInterruptStack(resumeThreadCallback, (UIntPtr)c);
                }
            }

            // Saved context will resume here
        }
Example #2
0
 internal static extern void TestSave(ref ThreadContext newContext);
Example #3
0
 internal static extern void SwitchToThreadContext(ref ThreadContext oldContext, ref ThreadContext newContext);