nsprpub/pr/src/cplus/rcmon.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/src/cplus/rcmon.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 +** Class: RCMonitor (ref prmonitor.h)
    1.11 +**
    1.12 +** RCMonitor.h - C++ wrapper around NSPR's monitors
    1.13 +*/
    1.14 +#if defined(_RCMONITOR_H)
    1.15 +#else
    1.16 +#define _RCMONITOR_H
    1.17 +
    1.18 +#include "rcbase.h"
    1.19 +#include "rcinrval.h"
    1.20 +
    1.21 +struct PRMonitor;
    1.22 +
    1.23 +class PR_IMPLEMENT(RCMonitor): public RCBase
    1.24 +{
    1.25 +public:
    1.26 +    RCMonitor();                    /* timeout is infinity */
    1.27 +    virtual ~RCMonitor();
    1.28 +
    1.29 +    virtual void Enter();           /* reentrant entry */
    1.30 +    virtual void Exit();
    1.31 +
    1.32 +    virtual void Notify();          /* possibly enable one thread */
    1.33 +    virtual void NotifyAll();       /* enable all waiters */
    1.34 +
    1.35 +    virtual void Wait();            /* applies object's timeout */
    1.36 +
    1.37 +    virtual void SetTimeout(const RCInterval& timeout);
    1.38 +
    1.39 +private:
    1.40 +    PRMonitor *monitor;
    1.41 +    RCInterval timeout;
    1.42 +
    1.43 +public:
    1.44 +    RCInterval GetTimeout() const;  /* get the current value */
    1.45 +
    1.46 +};  /* RCMonitor */
    1.47 +
    1.48 +#endif /* defined(_RCMONITOR_H) */
    1.49 +
    1.50 +/* RCMonitor.h */

mercurial