Hmm... I think it is definitely a worthy comment. I did not consider this when 
I wrote this code but one thing I did consider was the fact that this function 
is not thread safe. With these small helper functions I generally do not make 
them thread safe nor check what you are suggesting as I want to make them as 
small as possible and the presumption is that the user already knows that the 
channel is enabled. Thinking about this, I would be more inclined to 
NRFX_ASSERT() if the channel was not disabled when enabling or enabled when 
disabling it. I think that would point out some unexpected error. A compromise 
(so to speak) could be to return an error in that case and let the caller 
decide if they want to assert but again, this is starting to go against why I 
wanted to add these in the first place: less time/code spent enabling/disabling 
a channel by not calling channel_init() and channel_uninit(). I was even 
considering not checking the # of active channels for sanity when incrementing
  or decrementing it :-)

[ Full content available at: https://github.com/apache/mynewt-core/pull/1432 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to