You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now the only reason par_fold needs Self: 'static, T: 'static is because it uses plain thread::spawn for its worker threads, despite assuming they'll all be finished by the time it returns. Let's codify that and use some scoped threads instead.
For ParMap i bet it'll be a bit more difficult, since it'll need to hang onto the thread handles, but it's probably workable. Just need to make sure it can cancel the threads on Drop instead of just waiting for the whole map to finish.
The text was updated successfully, but these errors were encountered:
If mem::forget is called on a ParMap (when switched to scoped threads)? Then i guess you have a bigger problem on your hands. I'd probably put a lifetime parameter on it to have some kind of indicator for it, but honestly the question around forget in the first place seems eerily similar to discussions that already happened a couple years ago when thread::scoped got taken out of the standard library. Any problem with deliberately leaking a scoped thread handle in the first place also applies to the hypothetical ParMap, since it would be holding some.
Right now the only reason
par_fold
needsSelf: 'static, T: 'static
is because it uses plainthread::spawn
for its worker threads, despite assuming they'll all be finished by the time it returns. Let's codify that and use some scoped threads instead.For
ParMap
i bet it'll be a bit more difficult, since it'll need to hang onto the thread handles, but it's probably workable. Just need to make sure it can cancel the threads on Drop instead of just waiting for the whole map to finish.The text was updated successfully, but these errors were encountered: