@@ -42,7 +42,7 @@ class IAsyncQueueDispatcherBase
42
42
void finalize (future_base_t * fut);
43
43
44
44
// ! WORKER THREAD: returns when work is ready, will deadlock if the state will not eventually transition to pending
45
- [[nodiscard]] bool wait ();
45
+ [[nodiscard]] future_base_t * wait ();
46
46
// ! WORKER THREAD: to call after request is done being processed, will deadlock if the request was not executed
47
47
void notify ();
48
48
@@ -365,14 +365,14 @@ inline void IAsyncQueueDispatcherBase::request_base_t::finalize(future_base_t* f
365
365
state.exchangeNotify <false >(STATE::PENDING,STATE::RECORDING);
366
366
}
367
367
368
- inline bool IAsyncQueueDispatcherBase::request_base_t::wait ()
368
+ inline IAsyncQueueDispatcherBase:: future_base_t * IAsyncQueueDispatcherBase::request_base_t::wait ()
369
369
{
370
370
if (state.waitAbortableTransition (STATE::EXECUTING,STATE::PENDING,STATE::CANCELLED) && future->disassociate_request ())
371
- return true ;
371
+ return future ;
372
372
// assert(future->cancellable);
373
373
future = nullptr ;
374
374
state.exchangeNotify <false >(STATE::INITIAL,STATE::CANCELLED);
375
- return false ;
375
+ return nullptr ;
376
376
}
377
377
inline void IAsyncQueueDispatcherBase::request_base_t::notify ()
378
378
{
@@ -496,10 +496,10 @@ class IAsyncQueueDispatcher : public IThreadHandler<CRTP,InternalStateType>, pro
496
496
497
497
request_t & req = request_pool[r_id];
498
498
// do NOT allow cancelling or modification of the request while working on it
499
- if (req.wait ())
499
+ if (future_base_t * future= req.wait ())
500
500
{
501
501
// if the request supports cancelling and got cancelled, then `wait()` function may return false
502
- static_cast <CRTP*>(this )->process_request (nullptr /* TODO */ ,req.m_metadata ,optional_internal_state...);
502
+ static_cast <CRTP*>(this )->process_request (future ,req.m_metadata ,optional_internal_state...);
503
503
req.notify ();
504
504
}
505
505
// wake the waiter up
0 commit comments