Is it possible to get a race condition in PSoC?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

From my understanding, BLE subsystem (BLESS) runs concurrently with the main loop in the main() function. If both share a variable, is it possible to get a race condition? If it is possible, how to prevent it? Does PSoC creater supplies a mutex like object that we can use to lock/unlock?

0 Likes
1 Solution
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

Yes BLESS and main runs parallel.All the BLE events will automatically call the BLE event handler. All processes will be updated to the stack while CyBleProcessEvents( ) is called. All the updates happens after this based on the BLE packets. If the code is written in the way as mentioned in the code examples, race conditions will not occur.

   

Thanks,

   

Hima

View solution in original post

0 Likes
1 Reply
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

Yes BLESS and main runs parallel.All the BLE events will automatically call the BLE event handler. All processes will be updated to the stack while CyBleProcessEvents( ) is called. All the updates happens after this based on the BLE packets. If the code is written in the way as mentioned in the code examples, race conditions will not occur.

   

Thanks,

   

Hima

0 Likes