/****************lock**************/
#if defined(_WIN32)||defined(_WIN64)
CRITICAL_SECTION g_Mutex;
#else
pthread_mutex_t g_Mutex;
#endif
void InitLock()
{
#if defined(_WIN32)||defined(_WIN64)
InitializeCriticalSection(&g_Mutex);
#else
pthread_mutex_init(&g_Mutex,NULL);
#endif
}
void UninitLock()
{
#if defined(_WIN32)||defined(_WIN64)
DeleteCriticalSection(&g_Mutex);
#else
pthread_mutex_destroy(&g_Mutex);
#endif
}
void Lock()
{
#if defined(_WIN32)||defined(_WIN64)
EnterCriticalSection(&g_Mutex);
#else
pthread_mutex_lock(&g_Mutex);
#endif
}
void UnLock()
{
#if defined(_WIN32)||defined(_WIN64)
LeaveCriticalSection(&g_Mutex);
#else
pthread_mutex_unlock(&g_Mutex);
#endif
}