Hi,<div><br></div><div>I added a new test. You can run it by </div><div><br></div><div>$ ./CTKWidgetsCppTests ctkExampleUseOfWorkflowWidgetUsingThreads -I<br><br>in the project bin directory.</div><div><br></div><div>The onExit function of the steps start a thread that waits for 5 sec ("calculation"). The onExitComplete signal is sent when the thread finishes.</div>
<div><br></div><div>If you press the Next button, the "calculation" starts and after 5 sec you get to the next page. That is fine. However, if you press Next within this period, the thread of the second step will start, although the first step has not finished. (It has not sent the onExitComplete signal.)</div>
<div><br></div><div>You can checkout the test via GitHub:</div><div><br></div><div><a href="https://github.com/commontk/CTK/issues/61">https://github.com/commontk/CTK/issues/61</a></div><div><br></div><div>Thanks for dealing with this issue!</div>
<div><br></div><div>Best,</div><div>Miklos</div><div><br><div class="gmail_quote">On Mon, Oct 24, 2011 at 11:47 PM, Miklos Espak <span dir="ltr"><<a href="mailto:espakm@gmail.com">espakm@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div>By running the step in a different thread, what do you mean exactly ? <br>
</div></div></blockquote><div><br></div></div><div>Sorry, I was not clear. I run some calculations (ITK filters) in the workflow steps, and I start them in a new thread. The workflow step listens to the "finished" and "terminated" signal of the thread and it signals "onExitCompleted" after the thread is finished.</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div>As a side note: "Although <a href="http://doc.qt.nokia.com/stable/qobject.html" target="_blank">QObject</a> is reentrant, the GUI classes, notably <a href="http://doc.qt.nokia.com/stable/qwidget.html" target="_blank">QWidget</a> and all its subclasses, are not reentrant. They can only be used from the main thread."<br>
See <a href="http://doc.qt.nokia.com/stable/threads-qobject.html" target="_blank">http://doc.qt.nokia.com/stable/threads-qobject.html</a></div></div></blockquote><div><br></div></div><div>Yes, I had some troubles because of this, but I solved them. I refactored every GUI access from the function that runs the calculation. E.g. the thread that runs the calculation notifies the GUI thread through signals about the progress of the internal ITK filters. In this way the thread does not need to access the progress bar.</div>
<div class="im">
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div>Would it be possible for you to share some code ? May a topic on your CTK fork ?</div></blockquote></div></div></blockquote><div><br></div></div><div>Yes, I will upload a sample app tomorrow.</div><div><br></div><div>
Thanks,</div>
<div>Miklos</div><div><br></div></div>
</blockquote></div><br></div>