7#ifndef WATCHED_THREAD_H
8#define WATCHED_THREAD_H
13#include <boost/shared_ptr.hpp>
78 void start(
const boost::function<
void()>& thread_main);
98 void setError(
const std::string& error_msg);
Provides an IO "ready" semaphore for use with select() or poll() WatchSocket exposes a single open fi...
Provides a thread and controls for monitoring its activities.
bool isRunning()
Returns true if the thread is running.
void start(const boost::function< void()> &thread_main)
Creates and runs the thread.
WatchType
Enumerates the list of watch sockets used to mark events These are used as arguments to watch socket ...
std::string last_error_
Error message of the last error encountered.
void markReady(WatchType watch_type)
Sets a watch socket state to ready.
bool isReady(WatchType watch_type)
Indicates if a watch socket state is ready.
void setError(const std::string &error_msg)
Sets the error state.
virtual ~WatchedThread()
Virtual destructor.
WatchSocket sockets_[TERMINATE+1]
WatchSockets that are used to communicate with the owning thread There are three:
WatchedThread()
Constructor.
thread::ThreadPtr thread_
Current thread instance.
std::string getLastError()
Fetches the error message text for the most recent error.
void clearReady(WatchType watch_type)
Sets a watch socket state to not ready.
void stop()
Terminates the thread.
bool shouldTerminate()
Checks if the thread should terminate.
int getWatchFd(WatchType watch_type)
Fetches the fd of a watch socket.
boost::shared_ptr< WatchedThread > WatchedThreadPtr
Defines a pointer to a WatchedThread.
boost::shared_ptr< Thread > ThreadPtr
Thread pointer type.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Defines the class, WatchSocket.