Bug 884676 - Part 1: Remove unused ThreadPool::submitOne method. r=Waldo

This commit is contained in:
Joshua Cranmer 2013-07-13 20:05:11 -05:00
parent 1797e011d9
commit 94fcee5284
2 changed files with 9 additions and 36 deletions

View File

@ -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)
{

View File

@ -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