зеркало из https://github.com/mozilla/gecko-dev.git
Bug 884676 - Part 1: Remove unused ThreadPool::submitOne method. r=Waldo
--HG-- extra : rebase_source : 9791f3f79aa87ece38f8225e8b2b0217a147484a
This commit is contained in:
Родитель
7a4c2a9442
Коммит
d45742e480
|
@ -190,8 +190,7 @@ ThreadPool::ThreadPool(JSRuntime *rt)
|
|||
#if defined(JS_THREADSAFE) || defined(DEBUG)
|
||||
runtime_(rt),
|
||||
#endif
|
||||
numWorkers_(0), // updated during init()
|
||||
nextId_(0)
|
||||
numWorkers_(0) // updated during init()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -286,20 +285,6 @@ ThreadPool::terminateWorkers()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ThreadPool::submitOne(JSContext *cx, TaskExecutor *executor)
|
||||
{
|
||||
JS_ASSERT(numWorkers() > 0);
|
||||
JS_ASSERT(CurrentThreadCanAccessRuntime(runtime_));
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -49,14 +49,7 @@ 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
|
||||
// The 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
|
||||
|
@ -78,9 +71,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);
|
||||
|
@ -95,7 +85,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
|
||||
|
|
Загрузка…
Ссылка в новой задаче