On Monday, 19 March 2018 at 16:47:16 UTC, Graham Fawcett wrote:
On Friday, 9 March 2018 at 19:41:46 UTC, H. S. Teoh wrote:
Today I found myself needing a lazy, caching version of map() on an array. More precisely, given an array `T[] src` of source data and a function func(T) that's pretty expensive to compute, return an object `result` such that:

[...]

Map the sources to std.parallelism.Task instances, and yieldForce() the instances when you need the results?

On second thought, that won't work. AFIAK there's no way to take an unscheduled task and force it to execute on the current thread immediately and yield the result. But with such an operation, you could have a thread-local future/promise type that would meet your needs.

Graham

Reply via email to