internal void SubmitIfRunnable(ThreadPoolManager pools) { if (compareAndSet(RUNNABLE, SUBMITTED)) { _latestHandle = pools.Submit(_group, _task); _handleRelease.release(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void SetUp() { _clock = new FakeClock(); _pools = new ThreadPoolManager(new ThreadGroup("TestPool")); _scheduler = new TimeBasedTaskScheduler(_clock, _pools); _counter = new AtomicInteger(); _semaphore = new Semaphore(0); }
protected internal CentralJobScheduler() { _workStealingExecutors = new ConcurrentDictionary <Group, ExecutorService>(1); _topLevelGroup = new TopLevelGroup(); _pools = new ThreadPoolManager(_topLevelGroup); ThreadFactory threadFactory = new GroupedDaemonThreadFactory(Group.TASK_SCHEDULER, _topLevelGroup); _scheduler = new TimeBasedTaskScheduler(Clocks.nanoClock(), _pools); // The scheduler thread runs at slightly elevated priority for timeliness, and is started in init(). _schedulerThread = threadFactory.newThread(_scheduler); int priority = Thread.NORM_PRIORITY + 1; _schedulerThread.Priority = priority; }
internal TimeBasedTaskScheduler(SystemNanoClock clock, ThreadPoolManager pools) { this._clock = clock; this._pools = pools; _delayedTasks = new PriorityBlockingQueue <ScheduledJobHandle>(42, _deadlineComparator); }