[Issue 16601] New: No way to configure number of worker threads for default taskPool
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Fri Oct  7 10:36:14 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=16601
          Issue ID: 16601
           Summary: No way to configure number of worker threads for
                    default taskPool
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com
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())
    {
    }
}
-----
--
    
    
More information about the Digitalmars-d-bugs
mailing list