Example #1
0
sem * sem_alloc (const int val, const char * name)
{
    return sem_realloc (val, name, O_EXCL);
}
Example #2
0
//!
//! Allocate a new semaphore with the given name and mutex starting value.
//!
//! @param[in] val  the starting mutex count
//! @param[in] typeName the type of semaphore ('mutex' = pthread mutex; 'semaphore' = semaphore) if any other
//!                     name, then SYS V IPC semaphore is implied.
//!
//! @return a pointer to the newly allocated semaphore or NULL if a failure occured
//!
//! @see sem_realloc()
//! @see sem_free()
//!
//! @pre The name field must not be NULL.
//!
//! @post On success, a new semaphore will be allocated and initialized. If name happened to be NULL, a
//!       SIGABRT signal will be thrown by the application.
//!
//! @note Caller is responsible to free allocated memory for this semaphore. Call to sem_free() is
//!       prefered for this operation
//!
sem *sem_alloc(const int val, const char *typeName)
{
    return (sem_realloc(val, typeName, O_EXCL));
}