Thread: Mutex question

  1. #1
    Registered User
    Join Date
    Nov 2010

    Mutex question

    I'm writing a C program with mutex where I need to use the function pthread_mutex_destroy(). Searching on google I read that when this function is called by the thread that has the lock, all others threads that asked for the lock will receive an EDESTROYED error. I tried this on my program but the compiler tells me that EDESTROYED is wrong. Maybe I must import some library containing this error code? I tried to search but I didn't find anything about where EDESTROYED is defined. Can you help me?
    Thanks in advance!

  2. #2
    Join Date
    Dec 2007
    You were misinformed by Google. Read the man page for pthread_mutex_destoy():

    A destroyed mutex object can be reinitialized using pthread_mutex_init(); the results of otherwise referencing the object after it has been destroyed are undefined.
    Undefined behavior means it could do anything from silently fail to cause a seg fault and crash your program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mutex lock question
    By cjjoy1980 in forum Linux Programming
    Replies: 3
    Last Post: 07-17-2009, 10:05 AM
  2. Mutex question
    By laertius in forum C Programming
    Replies: 5
    Last Post: 09-17-2007, 12:16 PM
  3. Mutex in C
    By jgs in forum Windows Programming
    Replies: 4
    Last Post: 05-21-2005, 07:11 AM
  4. Quick mutex question
    By Thantos in forum Linux Programming
    Replies: 1
    Last Post: 02-21-2004, 07:10 PM
  5. Mutex
    By DutchStud in forum Windows Programming
    Replies: 2
    Last Post: 11-06-2001, 12:09 AM

Tags for this Thread