protected void WorkingMethod() { if (currentJob != null) { /* TODO: set CPU affinity */ try { Thread.BeginThreadAffinity(); if (currentJob.Begin() == JobResult.Normal) { jobQueue.Dequeue(); currentJob = jobQueue.Count != 0 ? jobQueue.Peek() : null; } } finally { Thread.EndThreadAffinity(); } } }