On 17 March 2015 at 23:39, Syam Krishnan <sya...@gmail.com> wrote: > On 03/17/2015 08:51 PM, André Somers wrote: >> Well, in any multi-threaded programming, you basicaly have no control >> over when something runs. That's up to the OS, not you. It will usually >> be "soonish", but...
True. The only time when I've experienced "non-soonish" behaviour though is when a non-real-time OS is under heavy load, which means everything gets significantly delayed anyway. <snip> > Well, my situation already needs me to poll objects periodically. > The following is indicative of my problem: > > while(1) > { > for(all_objects) > { > ret = object[i]->execute() > if(ret == complete) all_objects.remove( object[i] ); > } > > sleep(1ms); > } > > Now, object::execute() is supposed to get its work done by calling > do_something(). > execute() should not block but do_something() is blocking. That's why I > need to call it in a separate thread. > Till do_something() completes, subsequent calls to execute() shall > return a value indicating that it's execution > is not complete, so that it will not be removed from the list of objects > (all_objects). Does execute() do anything else besides call do_something(), and does your while-loop do anything else before sleeping? If not, what you really want is for QtConcurrent::map() to call execute()/do_something() on every object in your container. Regards, Sze-Howe _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest