Kea 2.5.6
interprocess_sync_file.h
Go to the documentation of this file.
1// Copyright (C) 2012-2015 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 INTERPROCESS_SYNC_FILE_H
8#define INTERPROCESS_SYNC_FILE_H
9
12
13namespace isc {
14namespace log {
15namespace interprocess {
16
22public:
23 InterprocessSyncFileError(const char* file, size_t line,
24 const char* what) :
25 isc::Exception(file, line, what) {}
26};
27
43public:
51 InterprocessSyncFile(const std::string& task_name) :
52 InterprocessSync(task_name), fd_(-1)
53 {}
54
56 virtual ~InterprocessSyncFile();
57
58protected:
63 bool lock();
64
68 bool tryLock();
69
73 bool unlock();
74
75private:
76 bool do_lock(int cmd, short l_type);
77
78 int fd_;
79};
80
81} // namespace interprocess
82} // namespace log
83} // namespace isc
84
85#endif // INTERPROCESS_SYNC_FILE_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
InterprocessSyncFileError(const char *file, size_t line, const char *what)
InterprocessSyncFile(const std::string &task_name)
Constructor.
bool lock()
Acquire the lock (blocks if something else has acquired a lock on the same task name)
bool tryLock()
Try to acquire a lock (doesn't block)
Defines the logger used by the top-level component of kea-lfc.