Results 1 to 4 of 4

Thread: Pthread

  1. #1
    Join Date
    Jul 2013
    Beans
    39

    Pthread

    Is a pthread_rwlock held by a thread automatically released if the thread holding it is killed or abnormally terminated, so the other threads waiting on the lock can acquire it ?

  2. #2
    Join Date
    Feb 2008
    Location
    Texas
    Beans
    29,807
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Pthread

    Thread moved to Programming Talk for a more appropriate fit.

  3. #3
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Pthread

    I wouldn't claim to be an expert in the finer details of pthreads but it seems to me that by default the lock is not released on process termination so waiting threads would continue to block. However, if you set the Robust attribute, this circumstance can be cleaned up by other threads. See http://man7.org/linux/man-pages/man3...robust.3p.html

  4. #4
    Join Date
    Jul 2013
    Beans
    39

    Re: Pthread

    I think I'll just try
    Code:
    pthread_setcancelstate()
    and
    Code:
    pthread_setcanceltype()
    . If this is not enough additionally I'll try
    Code:
    pthread_cleanup_push()
    and
    Code:
    pthread_cleanup_pop()
    .

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •