add vcglib

This commit is contained in:
yuanlin zhong committed 2025-11-03 17:46:44 +08:00
1 parent 6f6c0c8eb7
commit af8100f851
1537 files changed
+634197

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
#ifndef MT_RW_LOCK_H
#define MT_RW_LOCK_H
#include "base.h"
#include <pthread.h>
namespace mt
{
class rw_lock
{
MT_PREVENT_COPY(rw_lock)
public:
typedef rw_lock this_type;
typedef void base_type;
rw_lock(void)
{
pthread_rwlock_init(&(this->rw), 0);
}
~rw_lock(void)
{
pthread_rwlock_destroy(&(this->rw));
}
void lock_read(void)
{
pthread_rwlock_rdlock(&(this->rw));
}
void unlock_read(void)
{
pthread_rwlock_unlock(&(this->rw));
}
void lock_write(void)
{
pthread_rwlock_wrlock(&(this->rw));
}
void unlock_write(void)
{
pthread_rwlock_unlock(&(this->rw));
}
private:
pthread_rwlock_t rw;
};
}
#endif // MT_RW_LOCK_H