先看代码
/* 定义一个类型 SEMAPHORE,实际实现为内核中的自旋锁类型 spinlock_t */
typedef spinlock_t SEMAPHORE;
/* SEM_ID 是 SEMAPHORE 的别名,也即是自旋锁类型的标识符 */
typedef SEM_ID tosixSemId;
/* 宏定义 OsixSemMInit 用于初始化自旋锁,初始化时调用 spin_lock_init 函数 */
#define OsixSemMInit(pSem, options) \
spin_lock_init(pSem)
/*
#define OsixCreateMSem(options) \
semMCreate(options) // 注释掉的代码,可能用于创建互斥信号量
#define OsixCreateBSem(options, initialState) \
semBCreate(options, initialState) // 注释掉的代码,用于创建二值信号量
#define OsixCreateCSem(options, initialCount) \
semCCreate(options, initialCount) // 注释掉的代码,用于创建计数信号量
#define OsixDeleteSem(semId) \
semDelete(semId) // 注释掉的代码,用于删除信号量
*/
/*
#define OsixTakeSem(semId, ti