cpp/thread/promise

@1@ base template @2@ non-void specialization, used to communicate objects between threads @3@ void specialization, used to communicate stateless events

The class template provides a facility to store a value or an exception that is later acquired asynchronously via a std object created by the  object. Note that the object is meant to be used only once.

Each promise is associated with a shared state, which contains some state information and a result which may be not yet evaluated, evaluated to a value (possibly void) or evaluated to an exception. A promise may do three things with the shared state:
 * make ready: the promise stores the result or the exception in the shared state. Marks the state ready and unblocks any thread waiting on a future associated with the shared state.
 * release: the promise gives up its reference to the shared state. If this was the last such reference, the shared state is destroyed. Unless this was a shared state created by which is not yet ready, this operation does not block.
 * abandon: the promise stores the exception of type std with error code std, makes the shared state ready, and then releases it.

The promise is the "push" end of the promise-future communication channel: the operation that stores a value in the shared state synchronizes-with (as defined in std) the successful return from any function that is waiting on the shared state (such as std). Concurrent access to the same shared state may conflict otherwise: for example multiple callers of std must either all be read-only or provide external synchronization.