07-19-2012 01:18 PM
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?
07-20-2012 03:25 AM
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
07-20-2012 04:11 AM - edited 07-20-2012 04:20 AM
I did not suggest to shorten the processing time, only the callback
So the suggestion would be to have your button callback as follows:
if ( event == EVENT_COMMIT )
status != status;
if ( status )
// start thread
// 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