您的位置:首页 > 编程语言 > PHP开发

Jrtplib学习分析与记录1

2010-12-30 17:34 381 查看
Jmutex.h

#ifndef JMUTEX_H

#define JMUTEX_H

#if (defined(WIN32) || defined(_WIN32_WCE))

#ifndef _WIN32_WCE
#include <process.h>
#endif // _WIN32_WCE
#include <winsock2.h>
#include <windows.h>
#else // using pthread
#include <pthread.h>
#endif // WIN32

#define ERR_JMUTEX_ALREADYINIT						-1
#define ERR_JMUTEX_NOTINIT							-2
#define ERR_JMUTEX_CANTCREATEMUTEX					-3

class JMutex
{
public:
JMutex();
~JMutex();
int Init();
int Lock();
int Unlock();
bool IsInitialized() 						{ return initialized; }
private:
#if (defined(WIN32) || defined(_WIN32_WCE))
HANDLE mutex;
#else // pthread mutex
pthread_mutex_t mutex;
#endif // WIN32
bool initialized;
};

#endif // JMUTEX_H
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: