Could you give me some examples how to use the attach Thread?
Added by Everton Fonseca about 5 years ago
exemple#1
new Thread(()->{
//change something
}).start();
//calling
WApplication.getInstance().attachThread(true);
//end exemole#1
can I do it?
Replies (2)
RE: Could you give me some examples how to use the attach Thread? - Added by Wim Dumon about 5 years ago
Hey,
You'll have to call attachThread() in the new thread.
Also, calling attachThread() manually (and not having it as a consequence of grabbing the update lock) is a tell-tale signal of interacting with the widget tree without holding the lock.
final WApplication theApp = WApplication.getInstance(); new Thread(()->{ theApp.attachThread(true); //change something // actually, to change something you should have grabbed theApp's updatelock. }).start();
Wim.
RE: Could you give me some examples how to use the attach Thread? - Added by Everton Fonseca about 5 years ago
thanks Wim, now it is working = D