Home > pthread mutex destroy error > pthread_mutex_destroy error

Pthread_mutex_destroy Error

Contents

destroy and initialize a mutex SYNOPSIS [THR] pthread_mutex_destroy example [Option Start] #include <

Pthread_mutex_destroy Ebusy

href="../basedefs/pthread.h.html">pthread.h>

int pthread_mutex_destroy(pthread_mutex_t *
mutex);
int pthread_mutex_init(pthread_mutex_t *restrict
mutex,
const pthread_mutexattr_t *restrict
pthread_mutex_destroy error 16 attr);
pthread_mutex_t
mutex = PTHREAD_MUTEX_INITIALIZER; [Option End] DESCRIPTION The pthread_mutex_destroy() function shall destroy the mutex object referenced pthread_mutex_destroy necessary by mutex; the mutex object becomes, in effect, uninitialized. An implementation may cause pthread_mutex_destroy() to set the object referenced by mutex to an invalid value. A destroyed mutex object can be reinitialized using pthread_mutex_init(); the results of otherwise referencing the object after

Pthread_cond_destroy

it has been destroyed are undefined. It shall be safe to destroy an initialized mutex that is unlocked. Attempting to destroy a locked mutex results in undefined behavior. The pthread_mutex_init() function shall initialize the mutex referenced by mutex with attributes specified by attr. If attr is NULL, the default mutex attributes are used; the effect shall be the same as passing the address of a default mutex attributes object. Upon successful initialization, the state of the mutex becomes initialized and unlocked. Only mutex itself may be used for performing synchronization. The result of referring to copies of mutex in calls to pthread_mutex_lock(), pthread_mutex_trylock(), pthread_mutex_unlock(), and pthread_mutex_destroy() is undefined. Attempting to initialize an already initialized mutex results in undefined behavior. In cases where default mutex att

the interface may not be implemented on Linux. Name pthread_mutex_destroy, pthread_mutex_init - destroy and initialize a mutex Synopsis #include pthread mutex example int pthread_mutex_destroy(pthread_mutex_t *mutex); int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr); pthread_mutex_initializer vs pthread_mutex_init pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; Description The pthread_mutex_destroy() function shall destroy the mutex object referenced by mutex;

Pthread_mutex_init Example In C

the mutex object becomes, in effect, uninitialized. An implementation may cause pthread_mutex_destroy() to set the object referenced by mutex to an invalid value. A destroyed mutex object can http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_destroy.html be reinitialized using pthread_mutex_init(); the results of otherwise referencing the object after it has been destroyed are undefined. It shall be safe to destroy an initialized mutex that is unlocked. Attempting to destroy a locked mutex results in undefined behavior. The pthread_mutex_init() function shall initialize the mutex referenced by mutex with attributes specified by attr. https://linux.die.net/man/3/pthread_mutex_destroy If attr is NULL, the default mutex attributes are used; the effect shall be the same as passing the address of a default mutex attributes object. Upon successful initialization, the state of the mutex becomes initialized and unlocked. Only mutex itself may be used for performing synchronization. The result of referring to copies of mutex in calls to pthread_mutex_lock(), pthread_mutex_trylock(), pthread_mutex_unlock(), and pthread_mutex_destroy() is undefined. Attempting to initialize an already initialized mutex results in undefined behavior. In cases where default mutex attributes are appropriate, the macro PTHREAD_MUTEX_INITIALIZER can be used to initialize mutexes that are statically allocated. The effect shall be equivalent to dynamic initialization 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_destroy() and pthread_mutex_init() functions shall return zero; otherwise, an error number shall be returned to indicate the error. The [EBUSY] and [EINVAL] error checks, if implemented, act as if they were performed immediately at th

Login: [x] Format For Printing -XML -Clone This Bug -Last Comment First Last Prev Next This bug is not in your last search results. Bug113588 - NPTL pthread_mutex_destroy return EBUSY even if mutex is not locked... Summary: NPTL pthread_mutex_destroy return EBUSY even if mutex is not locked... Status: CLOSED NOTABUG Aliases: None Product: Red Hat Enterprise Linux 3 Classification: Red Hat Component: kernel (Show other bugs) Sub Component: --- Version: 3.0 Hardware: All Linux Priority medium Severity medium TargetMilestone: --- TargetRelease: --- Assigned To: Arjan van de Ven QA Contact: Brian Brock Docs Contact: URL: Whiteboard: Keywords: Depends On: Blocks: Show dependency tree /graph Reported: 2004-01-15 11:39 EST by Umesh R. Patil Modified: 2007-11-30 17:07 EST (History) CC List: 5 users (show) drepper.fsp petrides riel roland upatil See Also: Fixed In Version: Doc Type: Bug Fix Doc Text: Story Points: --- Clone Of: Environment: Last Closed: 2004-01-15 12:55:37 EST Type: --- Regression: --- Mount Type: --- Documentation: --- CRM: Verified Versions: Category: --- oVirt Team: --- RHEL 7.3 requirements from Atomic Host: Cloudforms Team: --- Attachments (Terms of Use) Add an attachment (proposed patch, testcase, etc.) Groups: None (edit) Description Umesh R. Patil 2004-01-15 11:39:08 EST From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922 Description of problem: pthread_mutex_destroy should return EBUSY if the mutex being destroyed is currently locked. If ptread_mutex_unlock is called without calling pthread_mutex_lock, pthread_mutex_destroy in NPTL returns EBUSY. This scenario can happen in cleanup handlers where a mutex is being unlocked when a thread exits. Version-Release number of selected component (if applicable): glibc-2.3.2-95.6, kernel-2.4.21-4.EL, RHE ES 3.0, gcc-3.2.3-20 How reproducible: Always Steps to Reproduce: 1. prog.c: #include #include #include int main(int argc, char **argv) { pthread_mutex_t mutt; int status; if ((status = pthread_mutex_init(&mutt, NULL)) == 0) { /* call unlock without first locking the mutex */ if ((status = pthread_mutex_unlock(&mutt)) == 0) { /* destroy results in EBUSY... */ if ((status = pthread_mutex_destroy(&mutt)) != 0) { char buf[256]; char *strErr = strerror_r(status, buf, 256); fprintf(stderr, "status=%d, Error: %s\n", status, strErr); } } } return 0; } 2. gcc -o prog prog.c -lpthread Actu

 

Related content

pthread_mutex_destroy error codes

Pthread mutex destroy Error Codes table id toc tbody tr td div id toctitle Contents div ul li a href Pthread mutex destroy Example a li li a href Pthread mutex destroy Error a li li a href Pthread mutex initializer Vs Pthread mutex init a li li a href Pthread mutex t Mutex a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you relatedl might have Meta Discuss the workings and policies of p h id Pthread mutex destroy Example p this site About Us

pthread_mutex_destroy error 16

Pthread mutex destroy Error table id toc tbody tr td div id toctitle Contents div ul li a href Pthread mutex destroy Ebusy a li li a href Pthread cond destroy a li li a href Pthread mutex t Struct a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta relatedl Discuss the workings and policies of this site About pthread mutex destroy example Us Learn more about Stack Overflow the company Business Learn more about hiring p h id Pthread mutex destroy

pthread_mutex_destroy error code 16

Pthread mutex destroy Error Code table id toc tbody tr td div id toctitle Contents div ul li a href Pthread cond destroy a li li a href Pthread Mutex Example a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings relatedl and policies of this site About Us Learn more about pthread mutex destroy example Stack Overflow the company Business Learn more about hiring developers or posting ads with pthread mutex destroy ebusy us Stack Overflow Questions Jobs Documentation