Because using a syncExec you suspend the thread SWTBot is running on,
and this can cause deadlocks. asyncExec is always preferable over
synExec; the only reason you would want a syncExec IMHO is when you are
waiting for a return value. For example, when you want to access some
widget's properties.
In the first version of the GEF support, the "click" methods on
SWTBotGefEditor were using syncExec, which caused deadlock. Take an
example where creating a new edit part by clicking on the canvas pops
open a modal dialog waiting for user input. Since the click call is
using syncExec, the SWTBot thread is suspended and waits for the UI
thread to return. But the UI thread is waiting for user input, which
the SWTBot thread can't give since it's suspended.
And this kind of deadlock could potentially happen for other kind of
events.
Hope this helps.
On 10-08-03 12:24 PM, Mickael Istria wrote:
Hi all,
I recently met some troubles with some SWTBot GEF tests. Indeed, it
happens that some events are not handled early enough for my test to
succeed. There are for sure things that I could improve in my test to
get them green, but I prefered digging in the SWTBotFigureCanvas code
to see how it works ;)
I noticed the use of asyncExec to give events to dispatcher, and async
is ofter something difficult to manage in tests. Why not using a
synchronous execution?
Regards,
--
Mickael Istria
R&D Engineer
This message and any attachment (the "message") is
intended solely for
the addressees and is confidential. If you receive this message by
mistake, please delete it and notify the sender immediately. Any use
not in accordance with its purpose, any out-spread or disclosure,
either as a whole or partially, is prohibited except with formal
approval. Internet cannot guarantee the integrity of this message,
therefore BonitaSoft will not be liable for the message if modified.
_______________________________________________
swtbot-dev mailing list
swtbot-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/swtbot-dev
|