Kea  1.5.0
thread.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef KEA_THREAD_H
8 #define KEA_THREAD_H
9 
10 #include <exceptions/exceptions.h>
11 
12 #include <boost/noncopyable.hpp>
13 #include <boost/function.hpp>
14 
15 namespace isc {
16 namespace util {
22 namespace thread {
23 
36 class Thread : public boost::noncopyable {
37 public:
44  public:
45  UncaughtException(const char* file, size_t line, const char* what) :
46  Exception(file, line, what)
47  {}
48  };
49 
70  Thread(const boost::function<void()>& main);
71 
82  ~Thread();
83 
94  void wait();
95 private:
96  class Impl;
97  Impl* impl_;
98 };
99 
101 typedef boost::shared_ptr<Thread> ThreadPtr;
102 
103 }
104 }
105 }
106 
107 #endif
int main(int argc, char *argv[])
Definition: agent/main.cc:16
UncaughtException(const char *file, size_t line, const char *what)
Definition: thread.h:45
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A separate thread.
Definition: thread.h:36
void wait()
Wait for the thread to terminate.
Definition: thread.cc:156
~Thread()
Destructor.
Definition: thread.cc:144
Thread(const boost::function< void()> &main)
Create and start a thread.
Definition: thread.cc:125
There's an uncaught exception in a thread.
Definition: thread.h:43
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< Thread > ThreadPtr
Thread pointer type.
Definition: thread.h:101