I am developing an application with a realtime context.
One of the threads that executes in realtime context dequeues Task message objects from a mailbox (with real-time capabilities). Those Task messages contain a std::promise and a command.
After the thread gets the Task it executes the command and after that, std::promise::set_value() will be called.
Because of that, I am concerned that calling std::promise::set_value() might not have real-time capability.
Does anybody knows if set::value() internally allocates heap storage or does something else that would break the real-time capability?
Here is some snipplet to hopefully make my question clearer:
void RealTimeThread::exec() { while( active_ ) { Task receivedTask; if( mailbox_.getMailTimed( receivedTask, std::chrono::milliseconds( 100 ) ) ) { try { if( receivedTask.cmd ) { receivedTask.cmd->execute(); } else { // TODO: some internal actions on timeout throw std::runtime_error{"Command invalid"}; } // does the following call has real-time capabilities? receivedTask.cmdPromise.set_value(); } catch( ... ) { receivedTask.cmdPromise.set_exception( std::current_exception() ); } } } }