tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

rcmon.h (1191B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 /*
      7 ** Class: RCMonitor (ref prmonitor.h)
      8 **
      9 ** RCMonitor.h - C++ wrapper around NSPR's monitors
     10 */
     11 #if defined(_RCMONITOR_H)
     12 #else
     13 #define _RCMONITOR_H
     14 
     15 #include "rcbase.h"
     16 #include "rcinrval.h"
     17 
     18 struct PRMonitor;
     19 
     20 class PR_IMPLEMENT(RCMonitor): public RCBase
     21 {
     22 public:
     23    RCMonitor();                    /* timeout is infinity */
     24    virtual ~RCMonitor();
     25 
     26    virtual void Enter();           /* reentrant entry */
     27    virtual void Exit();
     28 
     29    virtual void Notify();          /* possibly enable one thread */
     30    virtual void NotifyAll();       /* enable all waiters */
     31 
     32    virtual void Wait();            /* applies object's timeout */
     33 
     34    virtual void SetTimeout(const RCInterval& timeout);
     35 
     36 private:
     37    PRMonitor *monitor;
     38    RCInterval timeout;
     39 
     40 public:
     41    RCInterval GetTimeout() const;  /* get the current value */
     42 
     43 };  /* RCMonitor */
     44 
     45 #endif /* defined(_RCMONITOR_H) */
     46 
     47 /* RCMonitor.h */