Boost logo

Boost :

Subject: Re: [boost] [next gen future-promise] What to call themonadicreturntype?
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-25 19:58:33


> Seems to me that future and promise both first need to take their spinlock
> and then the other's, which creates the potential for deadlock.

You could fix that by preallocating a sufficiently big static array of
spinlocks, then generating an index when creating the promise and using
spinlock_[i] in both. Collisions are possible but harmless.

This non-allocating implementation is an interesting argument in favor of
the current "unique future", which I've long disliked. I prefer futures to
be shared_futures. That may too be possible to implement without allocation,
but it's kind of complicated.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk