yo/concrete/examples/monitor/run.cc
raw| 1 | #include "monitor.ih" |
| 2 | |
| 3 | int Monitor::s_initialize = Monitor::initialize(); |
| 4 | |
| 5 | void Monitor::run() |
| 6 | { |
| 7 | d_selector.addReadFd(STDIN_FILENO); |
| 8 | |
| 9 | while (true) |
| 10 | { |
| 11 | cout << "? " << flush; |
| 12 | try |
| 13 | { |
| 14 | d_selector.wait(); |
| 15 | |
| 16 | int fd; |
| 17 | while ((fd = d_selector.readFd()) != -1) |
| 18 | { |
| 19 | if (fd == STDIN_FILENO) |
| 20 | processInput(); |
| 21 | else |
| 22 | processChild(fd); |
| 23 | } |
| 24 | cout << "NEXT ...\n"; |
| 25 | } |
| 26 | catch (char const *msg) |
| 27 | { |
| 28 | exiting(1, msg); |
| 29 | } |
| 30 | } |
| 31 | } |