mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 926710 - Remove JS_THREADPOOL_SIZE in favor --thread-count. (r=nmatsakis)
This commit is contained in:
parent
f1970d7e7b
commit
a06904bcb5
@ -384,9 +384,6 @@ JSRuntime::init(uint32_t maxbytes)
|
||||
if (!scriptDataTable_.init())
|
||||
return false;
|
||||
|
||||
if (!threadPool.init())
|
||||
return false;
|
||||
|
||||
if (!evalCache.init())
|
||||
return false;
|
||||
|
||||
|
@ -188,40 +188,22 @@ ThreadPoolWorker::terminate()
|
||||
ThreadPool::ThreadPool(JSRuntime *rt)
|
||||
:
|
||||
#if defined(JS_THREADSAFE) || defined(DEBUG)
|
||||
runtime_(rt),
|
||||
runtime_(rt)
|
||||
#endif
|
||||
numWorkers_(0) // updated during init()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ThreadPool::init()
|
||||
{
|
||||
// Compute the number of worker threads (which may legally
|
||||
// be zero, as described in ThreadPool.h). This is not
|
||||
// done in the constructor because runtime_->useHelperThreads()
|
||||
// doesn't return the right thing then.
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
if (runtime_->useHelperThreads())
|
||||
numWorkers_ = GetCPUCount() - 1;
|
||||
else
|
||||
numWorkers_ = 0;
|
||||
|
||||
# ifdef DEBUG
|
||||
if (char *jsthreads = getenv("JS_THREADPOOL_SIZE"))
|
||||
numWorkers_ = strtol(jsthreads, nullptr, 10);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ThreadPool::~ThreadPool()
|
||||
{
|
||||
terminateWorkers();
|
||||
}
|
||||
|
||||
size_t
|
||||
ThreadPool::numWorkers() const
|
||||
{
|
||||
return runtime_->helperThreadCount();
|
||||
}
|
||||
|
||||
bool
|
||||
ThreadPool::lazyStartWorkers(JSContext *cx)
|
||||
{
|
||||
@ -240,7 +222,7 @@ ThreadPool::lazyStartWorkers(JSContext *cx)
|
||||
}
|
||||
|
||||
// Allocate workers array and then start the worker threads.
|
||||
// Note that numWorkers_ is the number of *desired* workers,
|
||||
// Note that numWorkers() is the number of *desired* workers,
|
||||
// but workers_.length() is the number of *successfully
|
||||
// initialized* workers.
|
||||
for (size_t workerId = 0; workerId < numWorkers(); workerId++) {
|
||||
|
@ -66,9 +66,6 @@ class ThreadPool
|
||||
#endif
|
||||
js::Vector<ThreadPoolWorker*, 8, SystemAllocPolicy> workers_;
|
||||
|
||||
// Number of workers we will start, when we actually start them
|
||||
size_t numWorkers_;
|
||||
|
||||
bool lazyStartWorkers(JSContext *cx);
|
||||
void terminateWorkers();
|
||||
void terminateWorkersAndReportOOM(JSContext *cx);
|
||||
@ -77,10 +74,8 @@ class ThreadPool
|
||||
ThreadPool(JSRuntime *rt);
|
||||
~ThreadPool();
|
||||
|
||||
bool init();
|
||||
|
||||
// Return number of worker threads in the pool.
|
||||
size_t numWorkers() { return numWorkers_; }
|
||||
size_t numWorkers() const;
|
||||
|
||||
// See comment on class:
|
||||
bool submitAll(JSContext *cx, TaskExecutor *executor);
|
||||
|
Loading…
Reference in New Issue
Block a user