xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grant Mc Auley" <gmcau...@som.llu.edu>
Subject RE: Waiting for RenderingCompleted
Date Wed, 10 Sep 2003 22:41:13 GMT

> > Grant Mc Auley wrote:
> > > Thank you for your quick reply.
> > > 
> > > I had already tried this (and just double checked it 
> again) but the
> > > mutex apparently never gets notified, the thread waits 
> indefinitely.
> > > That was why I was asking about how the GVTTreeBuilder 
> > thread is related
> > > to the main thread.  I have even tried spawning a thread 
> > from the main
> > > thread and locking on the mutex from it, but it hangs also.
> > 
> >    Is 'notifyAll' getting called?
> 
> No.  It looks like the event does not even get fired.  This 
> is the state
> of the GVTTreeBuilder thread when the main thread is waiting (ie,
> mutex.wait() ):
> 
> org.apache.batik.util.EventDispatcher
> org.apache.batik.swing.gvt.GVTTreeRenderer.fireEvent() 
> org.apache.batik.swing.gvt.GVTTreeRenderer.run() 
> 
> When I do not use the mutex and use a breakpoint in 
> renderingCompleted()
> I see this when stopped at the breakpoint:
> 
> java.awt.EventQueue.postEventPrivate()
> java.awt.EventQueue.postEvent()
> java.awt.EventQueue.invokeAndWait()
> org.apache.batik.util.EventDispatcher
> org.apache.batik.swing.gvt.GVTTreeRenderer.fireEvent() 
> org.apache.batik.swing.gvt.GVTTreeRenderer.run() 
> 
> So, somehow the waiting main thread seems to prevent the 
> posting of the
> event from the TreeBuilder thread.  
> 
> > 
> >    The GVTTreeBuilder is a seperate thread but I believe it 
> > notifies in the
> > AWT event thread.
> > 
> > > Without the wait/notify the renderingCompleted() returns OK 
> > and I can
> > > see the main thread wait()ing in my debugger.  So it 
> seems that the
> > > trouble is from the GVTTreeBuilder event handler end.
> > 
> >    Does it get into they sync blocks?
> 
> It gets into the first, and the main thread waits.  But as mentioned
> above, the event does not seem to get posted.
> 
> A deadlock would occur if the AWT Event thread was wait()ing for the
> wait()ing main thread.  I wonder if this occurs for applets.  In other
> words, is the AWT Event thread suspended until init() returns? 


OK, I put the the mutex in a thread spawned from the init() method.
This allows init() to return while the spawned thread wait()s on the
mutex and every thing works fine.  Earlier, I had tried join()ing the
spawned thread to the main in the init() method, without success.  So,
somehow it is necessary for init() to return.

Anyway, this will work for me.  Thank you for your efforts and a great
list!




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


Mime
View raw message