Home > Software engineering >  Pcomm interrupt function in question
Pcomm interrupt function in question

Time:10-23

Program I can open multiple serial ports, the serial port using sio_cnt_irq can set the same interrupt function?
Such as compilation on there is nothing wrong with me, but I'm not sure on execution,
For example, a serial port 1, 2, 3 are set the interrupt function void __stdcall Receive_Callback (int port); So at some point 1 serial port to trigger the interrupt function, in dealing with a return value of the serial port 1 (no treatment), the 2 serial data will not raise the interrupt, if triggered will affect 1 serial processing?
Please feel free to comment

CodePudding user response:

Enter the interrupt handling closed immediately after interruption, exit the interrupt processing before open the interrupt,
Seems to be the same interrupt not reentrant,

CodePudding user response:

First you need to understand the principle of the function call.

If your variables are local variables used in the callback, or are in the function of dynamically allocated. Then call the first time, these variables stack or heap address is different.
So it doesn't matter how many times you call, also won't influence each other.

However, if your function in the access to the same global variable, so each call, can lead to the global variable change, will affect other places calls.
  • Related