Thread work; engine->working(true); work.Run(callback(engine,&hEngine::getData));//-getData will do some UI refresh; while (engine->working()){ Refresh();//It cann't update UI here; Sleep(100); }
Thread work; engine->working(true); work.Run(callback(engine,&hEngine::getData));//-getData will do some UI refresh; while (engine->working()){ Refresh();//It cann't update UI here; Sleep(100); }
begin ///this block run in the main thread create and run task thread...... create and run task thread...... Application.processmessage;///refresh UI immediately. In U++,it does not work. create and run task thread...... create and run task thread...... do some job...... end
begin ///this block run in the main thread create and run task thread...... create and run task thread...... while not result do begin ///wait the task thread result and refresh UI. In U++, this will lock the GUI,other threads try to refresh the interface does not work sleep(100); Application.processmessage;///In delphi,this code is used to process GUI message in the main thread end; do some job...... end
void task_thread(){ create and run task thread1 create and run task thread2 .......... create and run waiting thread } void wait_thread(){ while (!result) Sleep(100); ........... }
static bool Ctrl::IsWaitingEvent(); static bool Ctrl::ProcessEvent(bool *quit = NULL); static bool Ctrl::ProcessEvents(bool *quit = NULL);