Jump to content

Race conditions: APP_DIN_NotifyToggle and co


jimi_diller
 Share

Recommended Posts

Hi,

 

What happens if:

 

1) I push a button so APP_DIN_NotifyToggle gets called

2) I quickly push a button again, before the previous APP_DIN_NotifyToggle was finished?

 

Could I possibly see some problems with race conditions? Or can I trust that APP_DIN_NotifyToggle is run with no pre-emption??

 

I'm guessing the former would make the most sense. I'm also seeing some bugs which I suspect might be attributed to race conditions, but that might also be due to shared data between APP_Background and the notify hooks, now that I think of it...

 

Thank you! Jimi

Link to comment
Share on other sites

Hi,

 

MIOS32_SRIO will set a "changed" flag whenever a DIN pin has toggled during a scan.

Even if the pin is toggled back to the original value, APP_DIN_NotifyToggle will still be called, but with the current value.

In other words: it won't be called twice.

 

If any edge is for interest, then you've to use the APP_SRIO_ServiceFinish() hook and detect pin changes from there (see also the various $MIOS32_PATH/modules/blm* examples) - but this is an interrupt. Time consuming operations (e.g. MIDI output) shouldn't be done from there. You would need to implement a queue mechanism if any pin change is really for interest.

 

 

I'm also seeing some bugs which I suspect might be attributed to race conditions

 

If you would describe your use case a little bit further, I could give you more concrete help how to solve the issues in your application...

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...