libzypp 17.37.17
zyppng::Wakeup Class Reference

#include <zypp-core/zyppng/thread/wakeup.h>

Public Member Functions

 Wakeup ()
 ~Wakeup ()
void notify ()
void ack ()
int pollfd () const
std::shared_ptr< SocketNotifiermakeNotifier (const bool enabled=true) const

Private Attributes

int _wakeupPipe [2] = { -1, -1 }

Detailed Description

Simple helper class that can be used to notify a thread to wake up. This is guaranteed to use signal safe means to wake up the thread.

Definition at line 22 of file wakeup.h.

Constructor & Destructor Documentation

◆ Wakeup()

zyppng::Wakeup::Wakeup ( )

Definition at line 11 of file wakeup.cpp.

◆ ~Wakeup()

zyppng::Wakeup::~Wakeup ( )

Definition at line 17 of file wakeup.cpp.

Member Function Documentation

◆ notify()

void zyppng::Wakeup::notify ( )

Post a notification to the thread.

Definition at line 23 of file wakeup.cpp.

◆ ack()

void zyppng::Wakeup::ack ( )

Called from the thread to acknowledge and clear the wakeup signal

Note
If this is not called the EventLoop in the thread will constantly wake up

Definition at line 28 of file wakeup.cpp.

◆ pollfd()

int zyppng::Wakeup::pollfd ( ) const

Returns the internal FD to be used in the thread to poll for notifications

Definition at line 34 of file wakeup.cpp.

◆ makeNotifier()

std::shared_ptr< SocketNotifier > zyppng::Wakeup::makeNotifier ( const bool enabled = true) const

Convenience function to create a zyppng::SocketNotifier that is listening for incoming notifications.

Definition at line 39 of file wakeup.cpp.

Member Data Documentation

◆ _wakeupPipe

int zyppng::Wakeup::_wakeupPipe[2] = { -1, -1 }
private

Definition at line 51 of file wakeup.h.


The documentation for this class was generated from the following files: