pthread_rwlock.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __PTHREAD_RWLOCK_H__
  2. #define __PTHREAD_RWLOCK_H__
  3. #include <rtthread.h>
  4. #include <pthread.h>
  5. #include <sys/time.h>
  6. struct pthread_rwlock
  7. {
  8. pthread_rwlockattr_t attr;
  9. struct rt_semaphore wrlock;
  10. struct rt_semaphore rdlock;
  11. };
  12. typedef struct pthread_rwlock pthread_rwlock_t;
  13. int pthread_rwlockattr_init (pthread_rwlockattr_t *attr);
  14. int pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr);
  15. int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *attr, int *pshared);
  16. int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, int pshared);
  17. int pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr);
  18. int pthread_rwlock_destroy (pthread_rwlock_t *rwlock);
  19. int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock);
  20. int pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock);
  21. int pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, const struct timespec *abstime);
  22. int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, const struct timespec *abstime);
  23. int pthread_rwlock_unlock (pthread_rwlock_t *rwlock);
  24. int pthread_rwlock_wrlock (pthread_rwlock_t *rwlock);
  25. int pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock);
  26. #endif