Question: how to implement rwlock in c?
Answer: Write Lock on Read-Write Lock #include <pthread. h> int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock ); pthread_rwlock_wrlock(3THR) applies a write lock to the read-write lock referenced by rwlock. The calling thread acquires the write lock if no other thread (reader or writer) holds the read-write lock rwlock.