mirror of
https://github.com/dlang/phobos.git
synced 2025-04-30 23:20:29 +03:00
Fix some unlisted bugs in std.parallelism.
This commit is contained in:
parent
8c0f365f9e
commit
58656cd76f
1 changed files with 12 additions and 27 deletions
|
@ -2151,6 +2151,7 @@ public:
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tasks.length > 0) {
|
||||||
try {
|
try {
|
||||||
(cast(AbstractTask*) &tasks[0]).job();
|
(cast(AbstractTask*) &tasks[0]).job();
|
||||||
} catch(Throwable e) {
|
} catch(Throwable e) {
|
||||||
|
@ -2162,6 +2163,7 @@ public:
|
||||||
foreach(ref task; tasks[1..$]) {
|
foreach(ref task; tasks[1..$]) {
|
||||||
tryDeleteExecute( cast(AbstractTask*) &task);
|
tryDeleteExecute( cast(AbstractTask*) &task);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now that we've tried to execute every task, they're all either
|
// Now that we've tried to execute every task, they're all either
|
||||||
// done or in progress. Force all of them.
|
// done or in progress. Force all of them.
|
||||||
|
@ -2950,18 +2952,6 @@ private mixin template ResubmittingTasks() {
|
||||||
pool.abstractPutGroupNoSync(head, tail);
|
pool.abstractPutGroupNoSync(head, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractTask* first; // Do in this thread.
|
|
||||||
|
|
||||||
void doFirst() {
|
|
||||||
if(first is null) return;
|
|
||||||
try {
|
|
||||||
first.job();
|
|
||||||
} catch(Throwable e) {
|
|
||||||
first.exception = e;
|
|
||||||
}
|
|
||||||
atomicSetUbyte(first.taskStatus, TaskStatus.done);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search for slots.
|
// Search for slots.
|
||||||
foreach(ref task; tasks) {
|
foreach(ref task; tasks) {
|
||||||
try {
|
try {
|
||||||
|
@ -2981,10 +2971,7 @@ private mixin template ResubmittingTasks() {
|
||||||
assert(task.next is null);
|
assert(task.next is null);
|
||||||
assert(task.prev is null);
|
assert(task.prev is null);
|
||||||
|
|
||||||
if(first is null) {
|
if(head is null) {
|
||||||
first = cast(AbstractTask*) &task;
|
|
||||||
first.taskStatus = TaskStatus.inProgress;
|
|
||||||
} else if(head is null) {
|
|
||||||
head = tail = cast(AbstractTask*) &task;
|
head = tail = cast(AbstractTask*) &task;
|
||||||
} else {
|
} else {
|
||||||
auto at = cast(AbstractTask*) &task;
|
auto at = cast(AbstractTask*) &task;
|
||||||
|
@ -2996,14 +2983,12 @@ private mixin template ResubmittingTasks() {
|
||||||
if(emptyCheck()) {
|
if(emptyCheck()) {
|
||||||
doGroupSubmit();
|
doGroupSubmit();
|
||||||
atomicSetUbyte(doneSubmitting, 1);
|
atomicSetUbyte(doneSubmitting, 1);
|
||||||
doFirst();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doGroupSubmit();
|
doGroupSubmit();
|
||||||
submitResubmittingTask(cast(AbstractTask*) &submitNextBatch);
|
submitResubmittingTask(cast(AbstractTask*) &submitNextBatch);
|
||||||
doFirst();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void submitAndExecute() {
|
void submitAndExecute() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue