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

+53
View File
@@ -0,0 +1,53 @@
#ifndef MT_CONDITION_H
#define MT_CONDITION_H
#include "base.h"
#include "mutex.h"
#include <pthread.h>
namespace mt
{
class condition
{
MT_PREVENT_COPY(condition)
public:
typedef condition this_type;
typedef void base_type;
condition(void)
{
pthread_cond_init(&(this->c), 0);
}
~condition(void)
{
pthread_cond_destroy(&(this->c));
}
void signal(void)
{
pthread_cond_signal(&(this->c));
}
void broadcast(void)
{
pthread_cond_broadcast(&(this->c));
}
void wait(mutex & m)
{
pthread_cond_wait(&(this->c), &(m.m));
}
private:
pthread_cond_t c;
};
}
#endif // MT_CONDITION_H