|
@@ -7,7 +7,7 @@ alias uint64 = ulong;
|
|
|
|
|
|
import std.stdio;
|
|
|
import std.concurrency : spawn;
|
|
|
-import std.parallelism : parallel;
|
|
|
+import std.parallelism : parallel, defaultPoolThreads;
|
|
|
import core.time : Duration, dur;
|
|
|
import core.thread : Thread;
|
|
|
|
|
@@ -59,6 +59,10 @@ void test4_spawner(){
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
+ writeln("defaultPoolThreads = ", defaultPoolThreads()); // 19
|
|
|
+ defaultPoolThreads(5);
|
|
|
+ writeln("defaultPoolThreads = ", defaultPoolThreads()); // 5
|
|
|
+
|
|
|
//int[] ints = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
|
int[] ints = [1, 2, 3, 4, 5];
|
|
|
|
|
@@ -75,6 +79,7 @@ void test4_spawner(){
|
|
|
./vtest2
|
|
|
// 21 threads for 10 elems
|
|
|
// 21 threads for 5 elems too
|
|
|
+// 7 threadf for 5 elems
|
|
|
// writeln locking
|
|
|
|
|
|
*/
|