Bug 22346 – TaskPool blocked when execute another task with TaskPool

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2021-09-30T03:29:42Z
Last change time
2024-12-01T16:39:23Z
Assigned to
No Owner
Creator
Heromyth
Moved to GitHub: phobos#10477 →

Comments

Comment #0 by bitworld — 2021-09-30T03:29:42Z
OS: Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux Compiler: DMD64 D Compiler v2.097.2 Here is the test code: ```d import std.stdio; import core.thread; import core.time; import std.parallelism; import std.experimental.logger; void main() { testTaskPool(); } void testTaskPool() { // enum Total = 15; // It's Ok when Total <= 15 enum Total = 16; // It's blocked by Thread.sleep(dur) when Total >= 16; for(size_t group = 0; group<Total; group++) { auto testTask = task(() { tracef("testing..."); try { useTaskPool(); // bug test // useThread(); // It's always ok } catch(Exception ex) { warning(ex); } Duration dur = 10.seconds; infof("Sleeping %s", dur); Thread.sleep(dur); infof("awake now"); tracef("testing done"); }); taskPool.put(testTask); } warning("press any key to close"); getchar(); } void useThread() { Thread th = new Thread(&doSomething); th.start(); // th.join(); } void useTaskPool() { auto testTask = task(&doSomething); taskPool.put(testTask); } ```
Comment #1 by robert.schadek — 2024-12-01T16:39:23Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10477 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB