MCPcopy Create free account
hub / github.com/bloomberg/quantum / IThreadFuture

Class IThreadFuture

quantum/interface/quantum_ithread_future.h:35–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33/// @brief Exposes methods to access a non-coroutine future (i.e. accessed from a thread)
34template <class T>
35struct IThreadFuture : public IThreadFutureBase
36{
37 using ContextTag = ThreadContextTag;
38 using Ptr = std::shared_ptr<IThreadFuture<T>>;
39 using Impl = Future<T>;
40
41 /// @brief Get the future value.
42 /// @return The future value.
43 /// @note Blocks until the future is ready or until an exception is thrown. Once this function returns, the future
44 /// becomes invalidated (i.e. cannot be read again)
45 template <class V = T>
46 NonBufferRetType<V> get();
47
48 /// @brief Get a reference the future value.
49 /// @return A reference to the future value.
50 /// @note Blocks until the future is ready or until an exception is thrown. Contrary to get(), this function does
51 /// not invalidate the future and as such may be read again.
52 template <class V = T>
53 const NonBufferRetType<V>& getRef() const;
54
55 /// @brief Pull a single value from the future buffer.
56 /// @tparam BUF Represents a class of type Buffer.
57 /// @tparam V The type of value contained in Buffer.
58 /// @param[out] isBufferClosed Indicates if this buffer is closed and no more Pull operations are allowed on it.
59 /// @return The next value pulled out from the front of the buffer.
60 /// @note Method available for buffered futures only. Blocks until one value is retrieved from the buffer.
61 template <class V = T>
62 BufferRetType<V> pull(bool& isBufferClosed);
63};
64
65template <class T>
66using ThreadFuture = IThreadFuture<T>;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected