CPN
Computational Process Networks
WakeupHandle.h
Go to the documentation of this file.
1 //=============================================================================
2 // Computational Process Networks class library
3 // Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4 //
5 // This library is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
14 //
15 // The GNU Public License is available in the file LICENSE, or you
16 // can write to the Free Software Foundation, Inc., 59 Temple Place -
17 // Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18 // World Wide Web at http://www.fsf.org.
19 //=============================================================================
24 #ifndef WAKEUPHANDLE_H
25 #define WAKEUPHANDLE_H
26 #pragma once
27 #include <cpn/common.h>
28 #include <cpn/io/FileHandle.h>
29 
35 class WakeupHandle : public FileHandle {
36 public:
37  WakeupHandle();
38  virtual ~WakeupHandle();
39 
43  void SendWakeup();
44 
47  void Read();
48 private:
49  // Always stay not readable
50  void OnReadable() {}
51  int wfd;
52 };
53 #endif
A convenience handle for event loops so that one can interrupt a Poll before it times out...
Definition: WakeupHandle.h:35
void Read()
Read until not readable anymore.
Definition: WakeupHandle.cc:70
void OnReadable()
Called by Poll when it detects that the file is readable.
Definition: WakeupHandle.h:50
void SendWakeup()
Causes this handler to become readable any Poll on this FileHandler will then return.
Definition: WakeupHandle.cc:50
A class to make it easy to deal with file descriptors.
virtual ~WakeupHandle()
Definition: WakeupHandle.cc:45
Generic file handle could be a file, or a socket or a device.
Definition: FileHandle.h:41