ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
636 B

  1. #ifndef CPPCMS_POSIX_MUTEX_H
  2. #define CPPCMS_POSIX_MUTEX_H
  3. #include <pthread.h>
  4. namespace cppcms {
  5. class mutex_lock {
  6. pthread_mutex_t &m;
  7. public:
  8. mutex_lock(pthread_mutex_t &p): m(p) { pthread_mutex_lock(&m); };
  9. ~mutex_lock() { pthread_mutex_unlock(&m); };
  10. };
  11. class rwlock_rdlock {
  12. pthread_rwlock_t &m;
  13. public:
  14. rwlock_rdlock(pthread_rwlock_t &p): m(p) { pthread_rwlock_rdlock(&m); };
  15. ~rwlock_rdlock() { pthread_rwlock_unlock(&m); };
  16. };
  17. class rwlock_wrlock {
  18. pthread_rwlock_t &m;
  19. public:
  20. rwlock_wrlock(pthread_rwlock_t &p): m(p) { pthread_rwlock_wrlock(&m); };
  21. ~rwlock_wrlock() { pthread_rwlock_unlock(&m); };
  22. };
  23. }
  24. #endif