/* Creates a new binary semaphore object with an initial count of 0, meaning that it's taken.  */
tTbxMbOsalSem TbxMbOsalSemCreate(void)
/* Creates a new binary semaphore object with an initial count of 0, meaning that it's taken.  */
tTbxMbOsalSem TbxMbOsalSemCreate(void)
{
  tTbxMbOsalSem result = NULL;
  tTbxMbOsalSemCtx * newSemCtx = TbxMemPoolAllocate(sizeof(tTbxMbOsalSemCtx));
  if (newSemCtx == NULL)
  {
    (void)TbxMemPoolCreate(1U, sizeof(tTbxMbOsalSemCtx));
    newSemCtx = TbxMemPoolAllocate(sizeof(tTbxMbOsalSemCtx));      
  }
  TBX_ASSERT(newSemCtx != NULL);
  if (newSemCtx != NULL)
  {
    newSemCtx->type = TBX_MB_OSAL_SEM_CONTEXT_TYPE;
    newSemCtx->count = 0U;
    result = newSemCtx;
  }
  return result;
}