[vtkusers] a problem about multithread and VTK again

lian jiang jl_vtk at yahoo.com
Fri Mar 29 23:59:50 EST 2002


Hi, all: 

         I  posted the mail once but did not receive any response. So I have to post it again and hope someone can give me a help. Sorry to bother you all. 
         I met a problem about VTK rendering window and multithread.  In my JAVA-VTK program, I have two button, A and B. In the method associated with A, there is an infinite loop, in which the actors are rendered from the first frame to last frame repeatedly in a rendering window. I set a globale variable "boolean jump=false". The infinite loop should exit by judging the value of "jump". In the method associated with button B, I set the variable as true.
        When I click A, the program will enter the infinite loop. I intend to exit the loop whenever I click the button B. But here is a problem. Once the program enters the dead loop, the GUI seems to be stucked and cann't respond to any user action. So the method of B can not set any global variable. 
         From the view of thread, it is easy to understand--because the two buttons are both in the GUI thread, the dead loop will surely block the GUI thread so that button B is disabled.    I tried to solve the problem by multithread. Although the loop can exit as I imaged,  there still are some problems. If I put the dead loop in a thread, the rendering window can not be refreshed. IF I put the method of B into a thread, button B will also be disable once the program goes into the dead loop.  I don't know whether it is a common problem for all kinds of window refreshing.  I had studied multithread used in VTK for some time. As far as I know, VTK window will cause some problems in multithread because VTK calls opengl which is not safe for thread. But I am not sure whether the refreshing problem described above is caused by VTK or other reasons.  Is it a common problem for all kinds window refreshing?  Is there a way to solve this problem?  Thank you very much. 


BEST WISHES 

Lian 




---------------------------------
Do You Yahoo!?
Yahoo! Greetings - send greetings for Easter,  Passover
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020329/e96b065a/attachment.htm>


More information about the vtkusers mailing list