|
| | PollNotifier (int, AbstractThread::PollEvents=AbstractThread::PollIn) |
| | Constructs a poll notifier. It assigns the file descriptor, and watches for events.
|
| |
| bool | setDescriptor (int, AbstractThread::PollEvents=AbstractThread::PollIn) |
| | Assigns the file descriptor and watch events.
|
| |
| bool | setEvents (AbstractThread::PollEvents) |
| | Set watch events.
|
| |
|
void | removeDescriptor () |
| | Remove the file descriptor.
|
| |
|
int | descriptor () |
| | Returns the file descriptor.
|
| |
|
bool | fail () |
| | Returns true if error occurred.
|
| |
The PollNotifier class Example:
#include <iostream>
#include <AsyncFw/MainThread>
#include <AsyncFw/PollNotifier>
int main(int argc, char *argv[]) {
notifier.notify([¬ifier](AsyncFw::AbstractThread::PollEvents e) {
char buf[128];
int r = read(STDIN_FILENO, buf, sizeof(buf) - 1);
buf[r] = 0;
if (r == 2 && buf[0] == 'q') AsyncFw::MainThread::exit();
(std::cout << "stdin: " << buf).flush();
});
(std::cout << "Start Applicaiton" << std::endl).flush();
int ret = AsyncFw::MainThread::exec();
return ret;
}