diff --git a/js/src/vm/ThreadPool.cpp b/js/src/vm/ThreadPool.cpp index 821f0cd922a..97ad637459d 100644 --- a/js/src/vm/ThreadPool.cpp +++ b/js/src/vm/ThreadPool.cpp @@ -187,8 +187,7 @@ ThreadPoolWorker::terminate() ThreadPool::ThreadPool(JSRuntime *rt) : runtime_(rt), - numWorkers_(0), // updated during init() - nextId_(0) + numWorkers_(0) // updated during init() { } @@ -283,21 +282,6 @@ ThreadPool::terminateWorkers() } } -bool -ThreadPool::submitOne(JSContext *cx, TaskExecutor *executor) -{ - JS_ASSERT(numWorkers() > 0); - - runtime_->assertValidThread(); - - if (!lazyStartWorkers(cx)) - return false; - - // Find next worker in round-robin fashion. - size_t id = JS_ATOMIC_INCREMENT(&nextId_) % numWorkers(); - return workers_[id]->submit(executor); -} - bool ThreadPool::submitAll(JSContext *cx, TaskExecutor *executor) { diff --git a/js/src/vm/ThreadPool.h b/js/src/vm/ThreadPool.h index 5999341c0b0..5528c425d44 100644 --- a/js/src/vm/ThreadPool.h +++ b/js/src/vm/ThreadPool.h @@ -48,21 +48,14 @@ class TaskExecutor // threads are disabled, or when manually specified for benchmarking // purposes). // -// You can either submit jobs in one of two ways. The first is -// |submitOne()|, which submits a job to be executed by one worker -// thread (this will fail if there are no worker threads). The job -// will be enqueued and executed by some worker (the current scheduler -// uses round-robin load balancing; something more sophisticated, -// e.g. a central queue or work stealing, might be better). -// -// The second way to submit a job is using |submitAll()|---in this -// case, the job will be executed by all worker threads. This does -// not fail if there are no worker threads, it simply does nothing. -// Of course, each thread may have any number of previously submitted -// things that they are already working on, and so they will finish -// those before they get to this job. Therefore it is possible to -// have some worker threads pick up (and even finish) their piece of -// the job before others have even started. +// The way to submit a job is using |submitAll()|, which executes the +// job on all worker threads. This does not fail if there are no +// worker threads, it simply does nothing. Of course, each thread may +// have any number of previously submitted things that they are +// already working on, and so they will finish those before they get +// to this job. Therefore it is possible to have some worker threads +// pick up (and even finish) their piece of the job before others +// have even started. class ThreadPool { private: @@ -75,9 +68,6 @@ class ThreadPool // Number of workers we will start, when we actually start them size_t numWorkers_; - // Next worker for |submitOne()|. Atomically modified. - uint32_t nextId_; - bool lazyStartWorkers(JSContext *cx); void terminateWorkers(); void terminateWorkersAndReportOOM(JSContext *cx); @@ -92,7 +82,6 @@ class ThreadPool size_t numWorkers() { return numWorkers_; } // See comment on class: - bool submitOne(JSContext *cx, TaskExecutor *executor); bool submitAll(JSContext *cx, TaskExecutor *executor); // Wait until all worker threads have finished their current set