cpp/thread/call once

Executes the object  exactly once, even if called concurrently from several threads.

In detail:


 * If, by the time is called,  indicates that  was already called,  returns right away (such a call to  is known as passive).


 * Otherwise, calls . Unlike the std constructor or std, the arguments are not moved or copied because they do not need to be transferred to another thread of execution. (such a call to  is known as active).


 * If that invocation throws an exception, it is propagated to the caller of, and is not flipped so that another call will be attempted (such a call to  is known as exceptional).
 * If that invocation returns normally (such a call to is known as returning),  is flipped, and all other calls to  with the same  are guaranteed to be passive.

All active calls on the same form a single total order consisting of zero or more exceptional calls, followed by one returning call. The end of each active call synchronizes-with the next active call in that order.

The return from the returning call synchronizes-with the returns from all passive calls on the same : this means that all concurrent calls to are guaranteed to observe any side-effects made by the active call, with no additional synchronization.

Return value
(none)

Exceptions

 * std if any condition prevents calls to from executing as specified
 * any exception thrown by