| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef LIBRARIES_NACL_IO_EVENT_EMITTER_SIGNAL_H_ |
| 6 #define LIBRARIES_NACL_IO_EVENT_EMITTER_SIGNAL_H_ |
| 7 |
| 8 #include <poll.h> |
| 9 |
| 10 #include "nacl_io/event_emitter.h" |
| 11 #include "sdk_util/auto_lock.h" |
| 12 #include "sdk_util/scoped_ref.h" |
| 13 |
| 14 namespace nacl_io { |
| 15 |
| 16 class EventEmitterSignal; |
| 17 typedef sdk_util::ScopedRef<EventEmitterSignal> ScopedEmitterSignal; |
| 18 |
| 19 class EventEmitterSignal : public EventEmitter { |
| 20 public: |
| 21 EventEmitterSignal() : events_(0) {}; |
| 22 |
| 23 virtual uint32_t GetEventStatus() { return events_; } |
| 24 |
| 25 void Raise(uint32_t events) { |
| 26 AUTO_LOCK(emitter_lock_); |
| 27 events_ |= events; |
| 28 RaiseEvents_Locked(POLLERR); |
| 29 } |
| 30 |
| 31 void Clear(uint32_t events) { |
| 32 AUTO_LOCK(emitter_lock_); |
| 33 events_ &= ~events; |
| 34 } |
| 35 |
| 36 protected: |
| 37 uint32_t events_; |
| 38 }; |
| 39 |
| 40 } // namespace nacl_io |
| 41 |
| 42 #endif // LIBRARIES_NACL_IO_EVENT_EMITTER_SIGNAL_H_ |
| 43 |
| OLD | NEW |