LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

In my code, I have an event callback function (RS232) who terminate another function, so don't finish a treatment.

I don't understand your desired behavior. Do you want the RS232 callback to terminate another function or not?

Case 1: You want the RS232 callback to terminate another function. Function1 is running, then an RS232 event happens and you want to terminate function1. You can set a global in the RS232 callback and check that global in function1. If function1 is doing some processing in a loop, check it in the loop. Otherwise (no function1 loop) you need to check the global multiple times in function1. If the global is set to terminate, have function1 (gracefully) exit.

Case 2: You don't want the RS232 callback to terminate another function. Function1 is running, then an RS232 event happens but you want to continue function1. You can setup the RS232 function to
run in another thread. Then function1 won't be interrupted for the RS232 function.

Without the global or new thread, function1 will get interrupted and paused (not terminated) for the RS232 callback, but after the RS232 function is complete, it will continue.
0 Kudos
Message 2 of 2
(2,801 Views)