7 #ifndef WATCHED_THREAD_H
8 #define WATCHED_THREAD_H
12 #include <boost/shared_ptr.hpp>
83 void start(
const std::function<
void()>& thread_main);
87 return (thread_ != 0);
103 void setError(
const std::string& error_msg);
117 void setErrorInternal(
const std::string& error_msg);
120 std::string last_error_;
145 #endif // WATCHED_THREAD_H
bool isRunning()
Returns true if the thread is running.
Provides a thread and controls for monitoring its activities.
std::string getLastError()
Fetches the error message text for the most recent error.
void stop()
Terminates the thread.
int getWatchFd(WatchType watch_type)
Fetches the fd of a watch socket.
bool shouldTerminate()
Checks if the thread should terminate.
WatchedThread()
Constructor.
void start(const std::function< void()> &thread_main)
Creates and runs the thread.
bool isReady(WatchType watch_type)
Indicates if a watch socket state is ready.
Defines the class, WatchSocket.
boost::shared_ptr< WatchedThread > WatchedThreadPtr
Defines a pointer to a WatchedThread.
void setError(const std::string &error_msg)
Sets the error state.
WatchType
Enumerates the list of watch sockets used to mark events These are used as arguments to watch socket ...
virtual ~WatchedThread()
Virtual destructor.
boost::shared_ptr< std::thread > ThreadPtr
Thread pointer type.
Provides an IO "ready" semaphore for use with select() or poll() WatchSocket exposes a single open fi...
Defines the logger used by the top-level component of kea-dhcp-ddns.
void clearReady(WatchType watch_type)
Sets a watch socket state to not ready.
void markReady(WatchType watch_type)
Sets a watch socket state to ready.