Guards and Guarded
Posted: Fri Jun 06, 2014 12:58 pm
I have some questions about these attributes
There is a brief mention of 'guarded' here but it doesn't provide a clearly documented example, I would like to understand all of the cases where this is required.
The 'independent_guard' was discovered when I added a state guard as part of a server task interface implementation like :
In this case because I had not added a guarded attribute to the refresh_display to definition of the display interface.
This also makes me wonder why we need to add the Guard attribute, as the compiler clearly detects the requirement itself. Are there exceptions or corner cases where this isn't so? could an example be provided to explain these choices and best uses etc..
I would love for some light to be shone on these attributes and their correct use.
P.S. I rephrased and moved this question from the startkit thread as figured it was worthy of it's own.
regards
Al
Code: Select all
[[guarded]]
[[independent_guard]]
The 'independent_guard' was discovered when I added a state guard as part of a server task interface implementation like :
Code: Select all
select {
..
case (state == READY) => display_if.refresh_display():
refreshDisplay();
break;
...
}
Code: Select all
../src/rgb-matrix-xcore.xc: In function `display_server':
../src/rgb-matrix-xcore.xc:73: error: select case on has guard without [[independent_guard]] case attribute or [[guarded]] interface function attribute
xmake[1]: *** [.build_Release/src/rgb-matrix-xcore.xc.o] Error 1
xmake: *** [bin/Release/rgb-matrix-xcore.xe] Error 2
I would love for some light to be shone on these attributes and their correct use.
P.S. I rephrased and moved this question from the startkit thread as figured it was worthy of it's own.
regards
Al