Thread safety improvements in the task system.

Removes some invalid safety annotations and adds a workaround for a starvation issue in Task.join() across threads boundaries. This is still not thread-safe, but now has a safety-net and is documented, so that it doesn't get lost.
This commit is contained in:
Sönke Ludwig 2016-12-19 20:24:08 +01:00
parent 1b2c0f33d1
commit 8c0660781d
3 changed files with 42 additions and 34 deletions

View file

@ -1212,8 +1212,8 @@ void setConcurrencyPrimitive(ConcurrencyPrimitive primitive)
atomicStore(st_concurrencyPrimitive, primitive);
}
void send(ARGS...)(Task task, ARGS args) { std.concurrency.send(task.tidInfo.ident, args); }
void prioritySend(ARGS...)(Task task, ARGS args) { std.concurrency.prioritySend(task.tidInfo.ident, args); }
void send(ARGS...)(Task task, ARGS args) { std.concurrency.send(task.tid, args); }
void prioritySend(ARGS...)(Task task, ARGS args) { std.concurrency.prioritySend(task.tid, args); }
package class VibedScheduler : Scheduler {
import core.sync.mutex;
@ -1239,7 +1239,7 @@ package class VibedScheduler : Scheduler {
}
}
override void yield() {}
override @property ref ThreadInfo thisInfo(){ return Task.getThis().tidInfo; }
override @property ref ThreadInfo thisInfo() @trusted { return Task.getThis().tidInfo; }
override TaskCondition newCondition(Mutex m)
{
try {