cwIoPresetSelApp.cpp : The app loop now only sleep for a fraction of 50ms depending on how long the app spent in io::exec().

This commit is contained in:
kevin 2024-01-06 08:57:24 -05:00
parent 6b771c0c88
commit 019d0d530b

View File

@ -3559,11 +3559,22 @@ cw::rc_t cw::preset_sel_app::main( const object_t* cfg, int argc, const char* ar
//io::uiReport(app.ioH);
// execute the io framework
while( !io::isShuttingDown(app.ioH))
{
time::spec_t t0;
time::get(t0);
// This call may block on the websocket handle.
io::exec(app.ioH);
sleepMs( app.psNextFrag != nullptr? 1 : 50 );
unsigned dMs = time::elapsedMs(t0);
if( dMs < 50 && app.psNextFrag == nullptr )
{
sleepMs( 50-dMs );
}
}
// stop the io framework