LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt running process

Hi,

 

I have a command button, which starts a long calculation process (signal computation, several graph updates, etc.). During the process everything is block in the GUI. Now I would like to add another button (or additional feature to the same button) to stop the running calcutation/visualization progress...

 

How can I manage that?

 

Cheers

0 Kudos
Message 1 of 7
(3,752 Views)
  • Don't dim (block) the Stop button
  • Avoid time-consuming callbacks because they lock out UI operation or add some calls to ProcessSystemEvents ()
0 Kudos
Message 2 of 7
(3,743 Views)

Its wanted that the processing takes so much time...

 

The only thing I would like to add is a kind of interrupt feature:

 

Button X has two functionalities:

- starting thread 1 with multiple calculations and visualizations

- if thread 1 is running, interrupting this thread again

0 Kudos
Message 3 of 7
(3,736 Views)

I did not suggest to shorten the processing time, only the callback Smiley Wink

 

So the suggestion would be to have your button callback as follows:

 

if ( event == EVENT_COMMIT )
{

    status != status;

    if ( status )

    {

//  start thread 

    }

    else

    {

//    stop thread

    }

}

 

This way your main (GUI) thread can react on user events, see also SetSleepPolicy and the multithreading examples provided by CVI.

 

I think that you actually do not even need to start and stop the thread in the callback, if your visualization thread (launched ahead) checks the status variable

0 Kudos
Message 4 of 7
(3,734 Views)

Hi HansiWWW,

 

I think what you're looking for is ProcessSystemEvents.

 

Cheers,

KyleP
Applications Engineer
National Instruments
0 Kudos
Message 5 of 7
(3,720 Views)

I did it like Wolfgang and KyleP said... It works fine... Thanks guys...

0 Kudos
Message 6 of 7
(3,704 Views)

...if your question got resolved, you could mark the answer as the solution... Smiley Happy When searching the forum solved threads are better than threads that are still open

Message 7 of 7
(3,682 Views)