1
0

lock_ptc.c 252 B

123456789101112131415161718
  1. #include <pthread.h>
  2. static pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
  3. void __inhibit_ptc()
  4. {
  5. pthread_rwlock_wrlock(&lock);
  6. }
  7. void __acquire_ptc()
  8. {
  9. pthread_rwlock_rdlock(&lock);
  10. }
  11. void __release_ptc()
  12. {
  13. pthread_rwlock_unlock(&lock);
  14. }