1 : /*
2 : * Copyright 2010 The Native Client Authors. All rights reserved.
3 : * Use of this source code is governed by a BSD-style license that can
4 : * be found in the LICENSE file.
5 : */
6 :
7 :
8 : // This module defines the interface for using platform specific events.
9 : // It is expected that the Allocation function will return NULL on any
10 : // failure instead of throwing an exception. This module is expected
11 : // to throw a std::exception when an unexpected OS error is encoutered.
12 : #ifndef NATIVE_CLIENT_PORT_EVENT_H_
13 : #define NATIVE_CLIENT_PORT_EVENT_H_ 1
14 :
15 : namespace port {
16 :
17 2 : class IEvent {
18 : public:
19 : virtual void Signal() = 0; // Free one waiting thread
20 : virtual void Wait() = 0; // Suspend this thread waiting for signal
21 :
22 : static IEvent *Allocate(); // Allocate an IEvent
23 : static void Free(IEvent *e); // Free the IEvent
24 :
25 : protected:
26 0 : virtual ~IEvent() {} // Prevent delete of base pointer
27 : };
28 :
29 :
30 : } // namespace port
31 :
32 : #endif // NATIVE_CLIENT_PORT_EVENT_H_
33 :
|