STATUS semBInit(SEMAPHORE* pSemaphore, int options, SEM_B_STATE initialState) { if((!semBLibInstalled)&&(OK!=semBLibInit())) { return (ERROR); } if(OK != semQInit(pSemaphore, options)) { return (ERROR); } return semBCoreInit(pSemaphore, options, initialState); }
STATUS semBInit( SEM_ID semId, int options, SEM_B_STATE state ) { STATUS status; /* Check if lib is installed */ if (semBLibInstalled != TRUE) { errnoSet(S_semLib_NOT_INSTALLED); status = ERROR; } else { if (options & SEM_DELETE_SAFE) { errnoSet(S_semLib_INVALID_OPTION); status = ERROR; } else { /* Initialize semaphore queue */ if (semQInit(&semId->qHead, options) != OK) { status = ERROR; } else { /* Initialize semaphore queue */ if (semBCoreInit(semId, options, state) != OK) { status = ERROR; } else { status = OK; } } } } return status; }