Is Event (ISR routine) thread-safe?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is Event (ISR routine) thread-safe?

Jump to solution
679 Views
davidzhou
Contributor V

Hi,

I have a general threading question: (K60 MCU)

Let say SPI module is setup and enabled with interrupt. The interrput is serviced through module Event:

void SM1_OnBlockSent(LDD_TUserData *UserDataPtr) {

      //

     iSharedVariableCmdSentDone=1;

}

is the accessing of the iSharedVariableCmdSentDone thread-safe in the SM1_OnBlockSent() ?

Thank you,

David Zhou

Labels (1)
0 Kudos
1 Solution
431 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello David

The global variables in ISR routines generated by PE are not thread-safe. The ISRs are not reentrant functions. User needs to pay attention in his application code to protect the data. 

Best Regards

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Mark Correct button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
432 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello David

The global variables in ISR routines generated by PE are not thread-safe. The ISRs are not reentrant functions. User needs to pay attention in his application code to protect the data. 

Best Regards

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Mark Correct button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
431 Views
davidzhou
Contributor V

Fiona,

Thank you for your answer.

David Zhou

0 Kudos