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

>>>>>>>>>> CSplit: Version 2.2 >>>>>>>>>>
>>>>>>>>>> CSplit: Begin part 5/6 >>>>>>>>>>
#define __SEMAPHORE_H
#define INCL_DOS
#define INCL_ERRORS
#include 
#include 
#include 
#include "error.h"
#if defined(__WATCOMC__)
#include 
#define CStringOf(str) (str)
#elif defined(__EMX__)
#include 
#define String string
#define CStringOf(str) ((str).c_str())
#else
#error string?
#endif
class Semaphore
{
    // This is simply a pure-virtual do-nothing class that all
    // semaphores will derive from.
private:
    // copy constructor/operator do _NOT_ EXIST!
    Semaphore(const Semaphore&);
    Semaphore& operator=(const Semaphore&);
public:
    Semaphore() {}
    virtual ~Semaphore() {}
    /*
     \
\
************************************************************************
     * Create allows the user to select which semaphore
     * to claim, rather than during construction.
     \
\
************************************************************************
     */
    virtual Error Create(const String& strSemName)=0;
    /*
     \
\
************************************************************************
     * Second create will create an anonymous (unnamed) semaphore.
     \
\
************************************************************************
     */
    virtual Error Create() =0;
    /*
     \
\
************************************************************************
     * Claim is a function that is designed to claim a semaphore.
     * If the semaphore cannot be grabbed in ulTimeOut milliseconds,
     * false is returned, otherwise true.  If the default parameter
     * is used, the function will only return when it can return true.
     *
     * Note: If the error is ERROR_SEM_OWNER_DIED, you may have cleanup \
\
to
     * do.
     \
\
************************************************************************
     */
    virtual Error Claim(unsigned long ulTimeOut = \
\
SEM_INDEFINITE_WAIT)=0;
    /*
     \
\
************************************************************************
     * Release will release the semaphore back to the OS.  Returns false
     * if the semaphore cannot be released, true otherwise.
     \
\
************************************************************************
     */
>>>>>>>>>> CSplit: End part 5/6 crc: 9e66 >>>>>>>>>>
--- 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™.