Home > pthread mutex init ebusy > pthread_mutex_init ebusy error

Pthread_mutex_init Ebusy Error

const pthread_mutexattr_t *attr); int pthread_mutex_destroy(pthread_mutex_t *mutex); pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; DESCRIPTION The pthread_mutex_init() function initialises the mutex referenced by mutex with attributes specified by attr. If attr is pthread_mutex_init example NULL, the default mutex attributes are used; the effect is the

Pthread_mutex_init Man

same as passing the address of a default mutex attributes object. Upon successful initialisation, the state of

Pthread_mutex_init Recursive

the mutex becomes initialised and unlocked. Attempting to initialise an already initialised mutex results in undefined behaviour. The pthread_mutex_destroy() function destroys the mutex object referenced by mutex; the

Pthread_mutex_initializer Example

mutex object becomes, in effect, uninitialised. An implementation may cause pthread_mutex_destroy() to set the object referenced by mutex to an invalid value. A destroyed mutex object can be re-initialised using pthread_mutex_init(); the results of otherwise referencing the object after it has been destroyed are undefined. It is safe to destroy an initialised mutex that is unlocked. pthread_mutexattr_t Attempting to destroy a locked mutex results in undefined behaviour. In cases where default mutex attributes are appropriate, the macro PTHREAD_MUTEX_INITIALIZER can be used to initialise mutexes that are statically allocated. The effect is equivalent to dynamic initialisation by a call to pthread_mutex_init() with parameter attr specified as NULL, except that no error checks are performed. RETURN VALUE If successful, the pthread_mutex_init() and pthread_mutex_destroy() functions return zero. Otherwise, an error number is returned to indicate the error. The [EBUSY] and [EINVAL] error checks, if implemented, act as if they were performed immediately at the beginning of processing for the function and cause an error return prior to modifying the state of the mutex specified by mutex. ERRORS The pthread_mutex_init() function will fail if: [EAGAIN] The system lacked the necessary resources (other than memory) to initialise another mutex. [ENOMEM] Insufficient memory exists to initialise the mutex. [EPERM] The caller does not have the privilege to perform the operation. The pthread_mutex_init() function may fail if: [EBUSY] The implementatio

- operations on mutexes Synopsis #include #include pthread_mutex_t fastmutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; pthread_mutex_t errchkmutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; pthread_mutex_t recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; pthread_cond_init pthread_mutex_t errchkmutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t pthread_mutex example *mutexattr); int pthread_mutex_lock(pthread_mutex_t *mutex); int pthread_mutex_trylock(pthread_mutex_t *mutex); int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec default mutex attributes *abs_timeout); int pthread_mutex_unlock(pthread_mutex_t *mutex); int pthread_mutex_consistent(pthread_mutex_t *mutex); int pthread_mutex_destroy(pthread_mutex_t *mutex); Description A mutex is a MUTual EXclusion device, and is useful for protecting http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_mutex_init.html shared data structures from concurrent modifications, and implementing critical sections and monitors. A mutex has two possible states: unlocked (not owned by any thread), and locked (owned by one thread). A mutex can never be owned by two different threads simultaneously. A thread attempting to https://www.sourceware.org/pthreads-win32/manual/pthread_mutex_init.html lock a mutex that is already locked by another thread is suspended until the owning thread unlocks the mutex first. pthread_mutex_init initializes the mutex object pointed to by mutex according to the mutex attributes specified in mutexattr. If mutexattr is NULL, default attributes are used instead. The type of a mutex determines whether it can be locked again by a thread that already owns it. The default type is “normal�. See pthread_mutexattr_init(3) for more information on mutex attributes. Variables of type pthread_mutex_t can also be initialized statically, using the constants PTHREAD_MUTEX_INITIALIZER (for normal “fast� mutexes), PTHREAD_RECURSIVE_MUTEX_INITIALIZER (for recursive mutexes), and PTHREAD_ERRORCHECK_MUTEX_INITIALIZER (for error checking mutexes). In the Pthreads-w32 implementation, an application should still call pthread_mutex_destroy at some point to ensure that any resources consumed by the mutex are released. Any mutex type c

be down. Please try the request again. Your cache administrator is webmaster. Generated Sun, 23 Oct 2016 09:44:11 GMT by s_ac4 (squid/3.5.20)

 

Related content

No related pages.