Is Event (ISR routine) thread-safe?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Is Event (ISR routine) thread-safe?

ソリューションへジャンプ
1,193件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
1 解決策
945件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
946件の閲覧回数
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 件の賞賛
返信
945件の閲覧回数
davidzhou
Contributor V

Fiona,

Thank you for your answer.

David Zhou

0 件の賞賛
返信