pthread_mutex_unlock() returns 1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anhpnt
    New Member
    • Dec 2009
    • 5

    pthread_mutex_unlock() returns 1

    When I use pthread_mutex_u nlock(), it returns value 1, which means EPERM or 'Operation not permitted'. The strange thing is it happens when my program have been executed for a while.
    I have searched the solution, and some results say that something is wrong with memory.
    Any suggestion?
  • RRick
    Recognized Expert Contributor
    • Feb 2007
    • 463

    #2
    Actually, EPERM means that the thread does not own the mutex. In particular:
    The pthread_mutex_u nlock() function unlocks the mutex specified. If the calling thread does not currently hold the mutex (via a previous call to pthread_mutex_l ock(), pthread_mutex_t rylock(), or pthread_mutex_t imedlock_np()) the unlock request fails with the EPERM error.

    Comment

    Working...