Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 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));
         }
     }
 }
Ejemplo n.º 11
0
 public static extern bool Join(ThreadHandle thread,
                                SchedulerTime stop);
Ejemplo n.º 12
0
 public static extern bool Join(ThreadHandle thread);
Ejemplo n.º 13
0
 public static extern bool Join(ThreadHandle thread,
                                TimeSpan timeout);
Ejemplo n.º 14
0
 public static extern ThreadState GetThreadState(ThreadHandle thread);
Ejemplo n.º 15
0
 public static extern TimeSpan GetExecutionTime(ThreadHandle thread);
Ejemplo n.º 16
0
 public static extern void SetAffinity(ThreadHandle thread, int val);
Ejemplo n.º 17
0
 public static extern int GetAffinity(ThreadHandle thread);
Ejemplo n.º 18
0
 public static extern void Start(ThreadHandle thread);
Ejemplo n.º 19
0
 public static extern void Dispose(ThreadHandle thread);
Ejemplo n.º 20
0
 public static void Dispose(ThreadHandle handle)
 {
     Tracing.Log(Tracing.Debug, "ThreadHandle.Dispose(id={0:x8})", handle.id);
     Thread.CurrentProcess.ReleaseHandle(handle.id);
 }