>>>>>>>>>> CSplit: Version 2.2 >>>>>>>>>>
>>>>>>>>>> CSplit: Begin part 6/6 >>>>>>>>>>
virtual bool Release()=0;
/*
\
\
************************************************************************
* Close will close up the semaphore completely, readying it for \
\
another
* "Create". Not recommended, only here for completeness.
\
\
************************************************************************
*/
virtual bool Close()=0;
/*
\
\
************************************************************************
* IsClaimed simply returns whether the usage count of the semaphore
* is > 0 for this thread.
\
\
************************************************************************
*/
virtual bool IsClaimed() const=0;
/*
\
\
************************************************************************
*operator bool() returns true if the semaphore has been created
*correctly, whether or not it has been claimed. For example,
*attempting to Create("\\SEM\\mysem") using Sem32 (32-bit
*Mutex semaphores) will result in operator bool() returning
*false.
\
\
************************************************************************
*/
virtual operator bool() const=0;
};
class SemUse
{
private:
Semaphore* m_ps;
public:
SemUse(Semaphore* ps) : m_ps(ps)
{
m_ps->Claim();
}
SemUse(Semaphore& s) : m_ps(&s)
{
m_ps->Claim();
}
SemUse(Semaphore* ps, unsigned long ulTimeout) : m_ps(ps)
{
m_ps->Claim(ulTimeout);
}
SemUse(Semaphore& s, unsigned long ulTimeout) : m_ps(&s)
{
m_ps->Claim(ulTimeout);
}
~SemUse()
{
m_ps->Release();
}
};
#endif // __SEMAPHORE_H
>>>>>>>>>> CSplit: End file semaphore.h >>>>>>>>>>
>>>>>>>>>> CSplit: End part 6/6 crc: 50e3 >>>>>>>>>>
--- FastEcho 1.46
---------------
* Origin: House of Fire BBS - Toronto - (416)601-0085 - v.34 (1:250/536)
|