syncExec Question [message #460217] |
Mon, 22 August 2005 21:54 |
Joe Mihalich Messages: 25 Registered: July 2009 |
Junior Member |
|
|
Hi, I have a question about Display.syncExec.
I have noticed through logging that the behavior
of this method is not completely what I'd expect.
I was under the impression that (at least under the windows
platform) syncExec would not execute until the next time the
main thread was available to run the Runnable object i passed
in.
So presumably, if the main thread was currently executing
some code that was not yielding control, the second thread
calling syncExec would block until the main thread finished
up, and the message pump resumed processing messages.
(I figured that the Win32 SendMessage was the basic
underlying mechanism that was used to implement this)
Anyway, so here is what I saw. I saw the main thread
chugging along doing it's thing, and then it's time slice
to run was up, so it was swapped out, and the 2nd thread
which had called syncExec, started to execute on
the main thread...which im my case was evil.
when the 2nd thread finished up, the first thread was
swapped back in, and resumed it's execution.
So, am I mis-understanding how syncExec really works
or are there some circumstances under which this will
legitamately happen?
Fyi, this was being run on SWT 3.0, in a client side
application, on windows XP Pro.
Thanks for any information you can provide.
Joe
|
|
|
Re: syncExec Question [message #460271 is a reply to message #460217] |
Tue, 23 August 2005 15:14 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The UI thread must of done a read/dispatch request because the syncExec
would not be processed until then. The 2nd thread would not continue
until after the runnable passed to the syncExec was executed on the UI
thread, and it would be executed when the UI thread returns to the
read/dispatch loop.
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.03655 seconds