Kea  2.3.5-git
unlock_guard.h
Go to the documentation of this file.
1 // Copyright (C) 2020 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 UNLOCK_GUARD_H
8 #define UNLOCK_GUARD_H
9 
10 #include <boost/noncopyable.hpp>
11 
12 namespace isc {
13 namespace util {
14 
20 template<typename Mutex>
21 class UnlockGuard : public boost::noncopyable {
22 public:
28  explicit UnlockGuard(Mutex& lock) : lock_(lock) {
29  lock_.unlock();
30  }
31 
36  lock_.lock();
37  }
38 
39 private:
41  Mutex& lock_;
42 };
43 
44 } // namespace util
45 } // namespace isc
46 
47 #endif // UNLOCK_GUARD_H
~UnlockGuard()
Destructor.
Definition: unlock_guard.h:35
UnlockGuard(Mutex &lock)
Constructor.
Definition: unlock_guard.h:28
Defines the logger used by the top-level component of kea-lfc.
Unlock Guard.
Definition: unlock_guard.h:21