michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: ** Class: RCMonitor (ref prmonitor.h) michael@0: ** michael@0: ** RCMonitor.h - C++ wrapper around NSPR's monitors michael@0: */ michael@0: #if defined(_RCMONITOR_H) michael@0: #else michael@0: #define _RCMONITOR_H michael@0: michael@0: #include "rcbase.h" michael@0: #include "rcinrval.h" michael@0: michael@0: struct PRMonitor; michael@0: michael@0: class PR_IMPLEMENT(RCMonitor): public RCBase michael@0: { michael@0: public: michael@0: RCMonitor(); /* timeout is infinity */ michael@0: virtual ~RCMonitor(); michael@0: michael@0: virtual void Enter(); /* reentrant entry */ michael@0: virtual void Exit(); michael@0: michael@0: virtual void Notify(); /* possibly enable one thread */ michael@0: virtual void NotifyAll(); /* enable all waiters */ michael@0: michael@0: virtual void Wait(); /* applies object's timeout */ michael@0: michael@0: virtual void SetTimeout(const RCInterval& timeout); michael@0: michael@0: private: michael@0: PRMonitor *monitor; michael@0: RCInterval timeout; michael@0: michael@0: public: michael@0: RCInterval GetTimeout() const; /* get the current value */ michael@0: michael@0: }; /* RCMonitor */ michael@0: michael@0: #endif /* defined(_RCMONITOR_H) */ michael@0: michael@0: /* RCMonitor.h */