Read-write lock with timeout

Source: Internet
Author: User

As with mutexes, the application avoids a permanent blocking state when acquiring read-write locks. These two functions are # include<pthread.h>#include<time.h>intPthread_rwlock_timedrdlock (pthread_rwlock_t *Restrict Rwlock,Const structTimespec *restrict abs_time- out);intPthread_rwlock_timedwrlock (pthread_rwlock_t *Restrict Rwlock,Const structTimespec *restrict abs_time- out); two functions behave similarly to their "no-time" versions. Abs_time-The out parameter points to the struct TIMESPEC structure, specifying when the thread should block. If they cannot acquire the lock, the two functions will return a etimedout error when the timeout expires. Like the Pthread_mutex_timedlock function, a timeout specifies an absolute time, not a relative time. 

Read-write lock with timeout

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.