当前位置: 技术问答>linux和unix
信号量的值超出范围错误 ERANGE
来源: 互联网 发布时间:2016-09-12
本文导语: 我自己实现的pv操作 TBOOL CPetSem::SemP(TINT32 dwSemIdx) { if(!m_bCanUse || dwSemIdx >= m_dwSemNum) return FALSE; while(1) { struct sembuf SemOp; SemOp.sem_num = dwSemIdx; SemOp.sem_op = -1; SemOp.sem_flg = SEM_UNDO; TINT32 dwRet = ...
我自己实现的pv操作
TBOOL CPetSem::SemP(TINT32 dwSemIdx)
{
if(!m_bCanUse || dwSemIdx >= m_dwSemNum)
return FALSE;
while(1)
{
struct sembuf SemOp;
SemOp.sem_num = dwSemIdx;
SemOp.sem_op = -1;
SemOp.sem_flg = SEM_UNDO;
TINT32 dwRet = semop(m_dwSemId, &SemOp,1);
if(dwRet = m_dwSemNum)
return FALSE;
while(1)
{
struct sembuf SemOp;
SemOp.sem_num = dwSemIdx;
SemOp.sem_op = 1;
SemOp.sem_flg = SEM_UNDO;
TINT32 dwRet = semop(m_dwSemId, &SemOp,1);
//P操作出错
if(dwRet