i using server push in wt , trying push new chart following code:
wt::wapplication::updatelock uilock(app); if (uilock){ chart_ste = new scatterplotexample(this,10*asf.get_outputsamplingrate()); app->triggerupdate(); } but waits program end , prints whereas following code in same program pushes word "demokritus every 0.5 secs should do:
for (int i=0; i<10; i++) { boost::this_thread::sleep(boost::posix_time::milliseconds(500)); wt::wapplication::updatelock uilock(app); if (uilock) { showfilename = new wtext(this); showfilename->settext(boost::lexical_cast<std::string>("demokritus")); app->triggerupdate(); } } what might mistake?
the documentation triggerupdate mentions "the update not immediate, , changes happen after call equally pushed client." if changes not immediate, first piece of code continuously tries push updates fast cpu allow it, never gets server because new update overwrites last , begins waiting again. try adding boost::this_thread::sleep(boost::posix_time::milliseconds(500)); first piece of code see if helps.
i've done project once needed update chart every second new data , had similar setup yours. put in sleep start because did not want boost thread use cpu.
also, unclear if first piece of code in bigger loop, if is, shouldn't make new chart every time, create before hand , update data. hope of helps.
Comments
Post a Comment