public static int GetAffinity(ThreadHandle handle) { int affinity = Processor.GetCurrentProcessorId(); Tracing.Log(Tracing.Debug, "ThreadHandle.GetAffinity(id={0:x8}, out affinity={1})", handle.id, (UIntPtr) unchecked (affinity)); return(affinity); }
public static void Start(ThreadHandle handle) { Thread thread = HandleTable.GetHandle(handle.id) as Thread; Tracing.Log(Tracing.Debug, "ThreadHandle.Start(id={0:x8})", handle.id); thread.Start(); }
public static void SetAffinity(ThreadHandle handle, int affinity) { Tracing.Log(Tracing.Debug, "ThreadHandle.SetAffinity(id={0:x8}, affinity={1})", handle.id, (UIntPtr) unchecked (affinity)); Thread thread = HandleTable.GetHandle(handle.id) as Thread; thread.SetAffinity(affinity); }
public static TimeSpan GetExecutionTime(ThreadHandle handle) { Thread thread = HandleTable.GetHandle(handle.id) as Thread; TimeSpan ts = thread.ExecutionTime; Tracing.Log(Tracing.Debug, "ThreadHandle.GetExecutionTime(id={0:x8}, out time=)", handle.id); return(ts); }
public static bool Join(ThreadHandle handle, SchedulerTime stop) { Thread thread = HandleTable.GetHandle(handle.id) as Thread; bool ret = thread.Join(stop); Tracing.Log(Tracing.Debug, "ThreadHandle.Join(id={0:x8}, stop=)", handle.id); return(ret); }
public static bool Join(ThreadHandle handle, TimeSpan timeout) { Thread thread = HandleTable.GetHandle(handle.id) as Thread; bool ret = thread.Join(timeout); Tracing.Log(Tracing.Debug, "ThreadHandle.Join(id={0:x8}, time=)", handle.id); return(ret); }
public static ThreadState GetThreadState(ThreadHandle handle) { Thread thread = HandleTable.GetHandle(handle.id) as Thread; ThreadState state = (ThreadState)thread.ThreadState; Tracing.Log(Tracing.Debug, "ThreadHandle.GetThreadState(id={0:x8}, out state={1})", handle.id, (UIntPtr) unchecked ((uint)state)); return(state); }
public static bool Join(ThreadHandle handle) { Thread thread = HandleTable.GetHandle(handle.id) as Thread; bool ret = true; thread.Join(); Tracing.Log(Tracing.Debug, "ThreadHandle.Join(id={0:x8})", handle.id); return(ret); }
public static unsafe bool Create(int threadIndex, ContainerHandle container, out ThreadHandle handle, out UIntPtr threadContext) { bool ret = Thread.CurrentProcess.CreateThread(threadIndex, out handle, out threadContext); Tracing.Log(Tracing.Debug, "ThreadHandle.Create(index={0}, cont={1:x8}) = {2:x8}", (UIntPtr) unchecked ((uint)threadIndex), container.id, handle.id); return(ret); }
public static unsafe bool Create(int threadIndex, ContainerHandle container, out ThreadHandle thread, out UIntPtr threadContext) { fixed(ThreadHandle *threadPtr = &thread) { fixed(UIntPtr *threadContextPtr = &threadContext) { return(CreateImpl(threadIndex, container, threadPtr, threadContextPtr)); } } }
public static extern bool Join(ThreadHandle thread, SchedulerTime stop);
public static extern bool Join(ThreadHandle thread);
public static extern bool Join(ThreadHandle thread, TimeSpan timeout);
public static extern ThreadState GetThreadState(ThreadHandle thread);
public static extern TimeSpan GetExecutionTime(ThreadHandle thread);
public static extern void SetAffinity(ThreadHandle thread, int val);
public static extern int GetAffinity(ThreadHandle thread);
public static extern void Start(ThreadHandle thread);
public static extern void Dispose(ThreadHandle thread);
public static void Dispose(ThreadHandle handle) { Tracing.Log(Tracing.Debug, "ThreadHandle.Dispose(id={0:x8})", handle.id); Thread.CurrentProcess.ReleaseHandle(handle.id); }