TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: DARIN MCBRIDE
date: 1997-08-31 09:50:00
subject: safequeue [6/6]

>>>>>>>>>> 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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.