Bug 16601 – No way to configure number of worker threads for default taskPool

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2016-10-07T17:36:00Z
Last change time
2016-11-21T23:08:33Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2016-10-07T17:36:14Z
The parallel() and other global functions use the taskPool() getter method to get the TaskPool on which to run parallel() on. In case of scripts it's useful to be able to define the number of threads a script can run in. But, the script then has to instantiate its own TaskPool and remember to use it. It would be useful to be able to do something like: ----- void main ( string[] args ) { size_t threads; getopt( args, "threads|t", "Max number of threads to run the script in", &threads); .taskPool.setThreadCount(threads); // runs in $threads number of threads foreach (item; buffer.parallel()) { } } -----
Comment #1 by andrej.mitrovich — 2016-11-21T23:08:33Z
Oh wait, I believe defaultPoolThreads already does this.