Fix FreeListRef related issues.
This commit is contained in:
parent
7dafccc3a7
commit
ccbd6a063f
2 changed files with 30 additions and 17 deletions
|
@ -1095,7 +1095,7 @@ struct Future(T) {
|
|||
{
|
||||
if (!ready) m_task.join();
|
||||
assert(ready, "Task still running after join()!?");
|
||||
return *cast(T*)m_result.get(); // casting away shared is safe, because this is a unique reference
|
||||
return *cast(T*)&m_result.get(); // casting away shared is safe, because this is a unique reference
|
||||
}
|
||||
|
||||
alias getResult this;
|
||||
|
@ -1135,7 +1135,7 @@ Future!(ReturnType!CALLABLE) async(CALLABLE, ARGS...)(CALLABLE callable, ARGS ar
|
|||
Future!RET ret;
|
||||
ret.init();
|
||||
static void compute(FreeListRef!(shared(RET)) dst, CALLABLE callable, ARGS args) {
|
||||
*dst = cast(shared(RET))callable(args);
|
||||
dst = cast(shared(RET))callable(args);
|
||||
}
|
||||
static if (isWeaklyIsolated!CALLABLE && isWeaklyIsolated!ARGS) {
|
||||
ret.m_task = runWorkerTaskH(&compute, ret.m_result, callable, args);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue