Chromium Code Reviews| Index: native_client_sdk/src/libraries/nacl_io/event_emitter_signal.h |
| diff --git a/native_client_sdk/src/libraries/nacl_io/event_emitter_signal.h b/native_client_sdk/src/libraries/nacl_io/event_emitter_signal.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..559784ee627a8813e80c21f9789fb0a187fd1047 |
| --- /dev/null |
| +++ b/native_client_sdk/src/libraries/nacl_io/event_emitter_signal.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef LIBRARIES_NACL_IO_EVENT_EMITTER_SIGNAL_H_ |
| +#define LIBRARIES_NACL_IO_EVENT_EMITTER_SIGNAL_H_ |
| + |
| +#include <poll.h> |
| + |
| +#include "nacl_io/event_emitter.h" |
| +#include "sdk_util/auto_lock.h" |
| +#include "sdk_util/scoped_ref.h" |
| + |
| +namespace nacl_io { |
| + |
| +class EventEmitterSignal; |
| +typedef sdk_util::ScopedRef<EventEmitterSignal> ScopedEmitterSignal; |
| + |
| +class EventEmitterSignal : public EventEmitter { |
| +public: |
| + EventEmitterSignal() : events_(0) {}; |
|
binji
2013/09/12 01:47:56
semicolon is unecessary
|
| + |
| + virtual uint32_t GetEventStatus() { return events_; } |
| + |
| + void Raise(uint32_t events) { |
| + AUTO_LOCK(emitter_lock_); |
| + events_ |= events; |
| + RaiseEvents_Locked(POLLERR); |
| + } |
| + |
| + void Clear(uint32_t events) { |
| + AUTO_LOCK(emitter_lock_); |
| + events_ &= ~events; |
| + } |
| + |
| + protected: |
|
binji
2013/09/12 01:47:56
I prefer member variables are private
|
| + uint32_t events_; |
| +}; |
| + |
| +} // namespace nacl_io |
| + |
| +#endif // LIBRARIES_NACL_IO_EVENT_EMITTER_SIGNAL_H_ |
| + |