Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » syncExec Question
syncExec Question [message #460217] Mon, 22 August 2005 21:54 Go to next message
Joe Mihalich is currently offline Joe MihalichFriend
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

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.

Re: syncExec Question [message #460271 is a reply to message #460217] Tue, 23 August 2005 15:14 Go to previous message
Eclipse UserFriend
Originally posted by:

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.

Rich Kulp
Previous Topic:How to activate HW button on Browser
Next Topic:Simple TreeViewer
Goto Forum:

Current Time: Thu Apr 22 10:07:09 GMT 2021

Powered by FUDForum. Page generated in 0.02248 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top