Mutex question

This is a discussion on Mutex question within the C Programming forums, part of the General Programming Boards category; Hello! I'm writing a C program with mutex where I need to use the function pthread_mutex_destroy(). Searching on google I ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    12

    Mutex question

    Hello!
    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
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,648
    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, 06:10 PM
  5. Mutex
    By DutchStud in forum Windows Programming
    Replies: 2
    Last Post: 11-05-2001, 11:09 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21