[Ctk-developers] workflow framework and threads

Miklos Espak espakm at gmail.com
Tue Oct 25 09:11:12 EDT 2011


Hi,

I added a new test. You can run it by

$ ./CTKWidgetsCppTests ctkExampleUseOfWorkflowWidgetUsingThreads -I

in the project bin directory.

The onExit function of the steps start a thread that waits for 5 sec
("calculation"). The onExitComplete signal is sent when the thread finishes.

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.)

You can checkout the test via GitHub:

https://github.com/commontk/CTK/issues/61

Thanks for dealing with this issue!

Best,
Miklos

On Mon, Oct 24, 2011 at 11:47 PM, Miklos Espak <espakm at gmail.com> wrote:

> By running the step in a different thread, what do you mean exactly ?
>>
>
> 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.
>
>
>> As a side note: "Although QObject<http://doc.qt.nokia.com/stable/qobject.html>is reentrant, the GUI classes, notably
>> QWidget <http://doc.qt.nokia.com/stable/qwidget.html> and all its
>> subclasses, are not reentrant. They can only be used from the main thread."
>> See http://doc.qt.nokia.com/stable/threads-qobject.html
>>
>
> 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.
>
> Would it be possible for you to share some code ? May a topic on your CTK
>>> fork ?
>>>
>>
> Yes, I will upload a sample app tomorrow.
>
> Thanks,
> Miklos
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ctk-developers/attachments/20111025/060368b0/attachment.html>


More information about the Ctk-developers mailing list