This interface exposes shared functionality between IThreadContext and ICoroContext.
More...
#include <quantum_icontext_base.h>
|
virtual | ~IContextBase ()=default |
| Virtual destructor. More...
|
|
virtual bool | valid () const =0 |
| Determines if the future object associated with this context has a valid shared state with the corresponding promise. More...
|
|
virtual bool | validAt (int num) const =0 |
| Determines if the future object associated with the 'num'-th continuation context is still valid. More...
|
|
virtual int | setException (std::exception_ptr ex)=0 |
| Set an exception in the promise associated with the current IThreadContext or ICoroContext. More...
|
|
This interface exposes shared functionality between IThreadContext and ICoroContext.
◆ Ptr
◆ ~IContextBase()
virtual Bloomberg::quantum::IContextBase::~IContextBase |
( |
| ) |
|
|
virtualdefault |
◆ setException()
virtual int Bloomberg::quantum::IContextBase::setException |
( |
std::exception_ptr |
ex | ) |
|
|
pure virtual |
Set an exception in the promise associated with the current IThreadContext or ICoroContext.
When setting an exception inside a promise, any attempt to read a value from the associated future will re-throw this exception. Any threads or coroutines already blocked on this future will immediately unblock and re-throw.
- Parameters
-
[in] | ex | An exception pointer which has been caught via std::current_exception. |
- Returns
- 0 on success
Implemented in Bloomberg::quantum::Context< RET >.
◆ valid()
virtual bool Bloomberg::quantum::IContextBase::valid |
( |
| ) |
const |
|
pure virtual |
Determines if the future object associated with this context has a valid shared state with the corresponding promise.
- Returns
- True if valid, false otherwise.
Implemented in Bloomberg::quantum::Context< RET >.
◆ validAt()
virtual bool Bloomberg::quantum::IContextBase::validAt |
( |
int |
num | ) |
const |
|
pure virtual |
Determines if the future object associated with the 'num'-th continuation context is still valid.
When using coroutine continuations, any future in the continuation chain can be validated using this function. Allowed range for num is [-1, total_continuations). -1 is equivalent of calling valid() or validAt(total_continuations-1) on the last context in the chain (i.e. the context which is returned via IThreadContext::end() or ICoroContext::end()). Position 0 represents the first future in the chain.
- Parameters
-
[in] | num | The number indicating which future to validate. |
- Returns
- True if valid, false otherwise.
Implemented in Bloomberg::quantum::Context< RET >.