libzypp 17.37.17
wakeup.cpp
Go to the documentation of this file.
1#include "wakeup.h"
2
4#include <zypp-core/zyppng/base/SocketNotifier>
5
6#include <unistd.h>
7#include <fcntl.h>
8
9namespace zyppng {
10
12 {
13 ::pipe ( _wakeupPipe );
14 ::fcntl( _wakeupPipe[0], F_SETFL, O_NONBLOCK );
15 }
16
18 {
19 ::close (_wakeupPipe[0]);
20 ::close (_wakeupPipe[1]);
21 }
22
24 {
25 eintrSafeCall( ::write, _wakeupPipe[1], "\n", 1);
26 }
27
29 {
30 char dummy = 0;
31 while ( eintrSafeCall( ::read, _wakeupPipe[0], &dummy, 1 ) > 0 ) { continue; }
32 }
33
34 int Wakeup::pollfd() const
35 {
36 return _wakeupPipe[0];
37 }
38
39 std::shared_ptr<SocketNotifier> Wakeup::makeNotifier( const bool enabled ) const
40 {
42 }
43
44}
static Ptr create(int socket, int evTypes, bool enable=true)
std::shared_ptr< SocketNotifier > makeNotifier(const bool enabled=true) const
Definition wakeup.cpp:39
void notify()
Definition wakeup.cpp:23
int pollfd() const
Definition wakeup.cpp:34
int _wakeupPipe[2]
Definition wakeup.h:51
auto eintrSafeCall(Fun &&function, Args &&... args)