?? os_system.h
字號:
#ifndef __OS_SYSTEM_H__
#define __OS_SYSTEM_H__
#ifdef __cplusplus
extern "C" {
#endif
#if (__OS_TYPE__ == __OS_WIN32__)
#include <process.h>
/* Win32進程編號數據類型*/
typedef DWORD OS_PID_T ;
/* 取得當前進程編號*/
#define OS_GetCurPid GetCurrentProcessId
/* 線程鎖,采用臨界區機制*/
typedef CRITICAL_SECTION THREAD_LOCK_T;
#define OS_ThreadLockCreate(lock) InitializeCriticalSection(lock)
#define OS_ThreadLock(lock) EnterCriticalSection(lock);
#define OS_ThreadUnLock(lock) LeaveCriticalSection(lock)
#define OS_ThreadLockDestory(lock) DeleteCriticalSection(lock)
#define OS_Sleep(sec) Sleep(sec*1000)
#define strcasecmp _stricmp
#define snprintf _snprintf
#elif (__OS_TYPE__ == __OS_LINUX__)
#include <pthread.h>
/* Linux 進程編號數據類型*/
typedef pid_t OS_PID_T;
/* 取得當前進程編號*/
#define OS_GetCurPid getpid
/* 線程鎖,采用pthread線程鎖機制*/
typedef pthread_mutex_t THREAD_LOCK_T;
#define OS_ThreadLockCreate(lock) pthread_mutex_init(lock,NULL)
#define OS_ThreadLock(lock) pthread_mutex_lock(lock)
#define OS_ThreadUnLock(lock) pthread_mutex_unlock(lock)
#define OS_ThreadLockDestory(lock) pthread_mutex_destory(lock)
#define OS_Sleep(sec) sleep(sec)
#else
#error unknow system define !
#endif
#ifdef __cplusplus
}
#endif
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -