Semaphore Wait/Reset
Posted: Thu Dec 15, 2016 8:21 am
when using a binary semaphore does one need to use the chBSemReset before chBSemWait? see usage below
// Initialized like this
chBSemObjectInit( &sLock, true );
// Signal sent from Ext interrupt or timer
chBSemSignalI( &sLock );
// usage like this
I ask as it seems to work with or without it
// Initialized like this
chBSemObjectInit( &sLock, true );
// Signal sent from Ext interrupt or timer
chBSemSignalI( &sLock );
// usage like this
Code: Select all
while( TRUE )
{
chBSemReset( &sLock, true );
status = chBSemWait( &sLock );
if( status == MSG_OK )
{
// do some work
}
}
I ask as it seems to work with or without it