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 [4/6]

>>>>>>>>>> CSplit: Version 2.2 >>>>>>>>>>
>>>>>>>>>> CSplit: Begin part 4/6 >>>>>>>>>>
}
bool MutexSem::Release()
{
    return NO_ERROR == DosReleaseMutexSem(m_hmtxProtFile);
}
bool MutexSem::Close()
{
    return NO_ERROR == DosCloseMutexSem(m_hmtxProtFile);
}
bool MutexSem::IsClaimed() const
{
    // First we gotta query the semaphore.
    PID pid;
    TID tid;
    ULONG ulCount;
    DosQueryMutexSem(m_hmtxProtFile, &pid, &tid, &ulCount);
    // quick check: no one has claimed it:
    if (0 == ulCount)
    {
        return false;
    }
    // otherwise, we must find out our process and thread ids.
    PPIB ppib;
    PTIB ptib;
    APIRET ulrcDGIB = DosGetInfoBlocks(&ptib, &ppib);
    if (NO_ERROR != ulrcDGIB)
    {
        return false; // don't know what else to say...
    }
    // It is claimed only if both our process and thread match.
    return pid == ppib->pib_ulpid && tid == ptib->tib_ptib2->tib2_ultid;
}
MutexSem::operator bool() const
{
    return m_hmtxProtFile != 0;
}
>>>>>>>>>> CSplit: End file sem32.cc >>>>>>>>>>
>>>>>>>>>> CSplit: Begin file sem32.h >>>>>>>>>>
//
// Class for implementing 16 & 32-bit semaphores
//
#ifndef __SEMAPHORE__HPP
#define __SEMAPHORE__HPP
#include "semaphore.h"
#include 
class MutexSem : public Semaphore
{
private:
    HMTX   m_hmtxProtFile;
public:
    MutexSem();
    virtual ~MutexSem();
    virtual Error Create(const String& strSemName);
    virtual Error MutexSem::Create();
    virtual Error Claim(unsigned long ulTimeOut = \
\
SEM_INDEFINITE_WAIT);
    virtual bool Release();
    virtual bool Close();
    virtual bool IsClaimed() const;
    virtual operator bool() const;
};
#endif // __SEMAPHORE__HPP
>>>>>>>>>> CSplit: End file sem32.h >>>>>>>>>>
>>>>>>>>>> CSplit: Begin file semaphore.h >>>>>>>>>>
//
// Abstraction of semaphore operations.
//
#ifndef __SEMAPHORE_H
>>>>>>>>>> CSplit: End part 4/6 crc: 0364 >>>>>>>>>>
--- 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™.