xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bishop, Michael W. CONTR J9C880" <Michael.Bis...@je.jfcom.mil>
Subject RE: Seemingly odd question...
Date Thu, 23 Mar 2006 16:39:02 GMT
So I should be using invokeAndWait(), but in that case I could run into deadlocking issues
like I've had in the past?
Michael Bishop


From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
Sent: Thu 3/23/2006 11:35 AM
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: RE: Seemingly odd question...

Hi all,

Andrew Plotkin <erkyrath@eblong.com> wrote on 03/23/2006 11:14:21 AM:

> On Wed, 22 Mar 2006, Bishop, Michael W. CONTR J9C880 wrote:
> > Even with a call to invokeLater()?  It'd seem that invokeLater() just
> > kicks off a Thread and returns...
> No, it kicks the task into the queue and returns. The queue occupies a
> single thread, which executes tasks serially.

   Correct Andrew there is exactly one thread for the RunnableQueue.  All
Runnables are executed in that thread in the order that they are added to
the runnable list (there is actually an interface for 'preempting' the
but that isn't relevant here).

   However, if you have multiple threads calling invokeLater the Runnable
Queue doesn't (and can't) enforce any order between the threads.  The
method is thread safe (multiple threads can safely call it) but the
critical section is actually inside the method so if you want to ensure
that thread B submits it's runnable after thread A then thread B must
wait until thread A returns from the call to invokeLater.

> That's why they call it a queue. :)

   Correct ;)

To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message