lparallel icon indicating copy to clipboard operation
lparallel copied to clipboard

Add a timeout option for `force`

Open tmccombs opened this issue 9 years ago • 3 comments

It would be nice to have a way for force to timeout while waiting for a promise to be fulfilled.

tmccombs avatar Feb 15 '16 19:02 tmccombs

Yes I had been thinking about try-force -- it's not in yet because the timeout option in bordeaux-threads is relatively recent and lparallel doesn't yet require it. Since futures can return multiple values, try-force may be a bit cumbersome, though, like (multiple-value-bind (vals success) (try-force f) ...).

lmj avatar Feb 26 '16 20:02 lmj

This requires an additional slot for a condition variable in the future struct, which may be another reason that I avoided it. As with queues the cvar would be lazily created, but futures would be a little heavier nonetheless. Benchmarks probably won't be affected where waiting with timeout is never done.

lmj avatar Feb 27 '16 20:02 lmj

One to deal with muliple values could be to signal a condition on a timeout, but that would be more cumbersome for the user to handle, and would be inconsistent with the timeout behavior for queues.

tmccombs avatar Feb 29 '16 18:02 tmccombs