log4cplus
2.0.5
include
log4cplus
helpers
lockfile.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Copyright (C) 2012-2017, Vaclav Zeman. All rights reserved.
4
//
5
// Redistribution and use in source and binary forms, with or without modifica-
6
// tion, are permitted provided that the following conditions are met:
7
//
8
// 1. Redistributions of source code must retain the above copyright notice,
9
// this list of conditions and the following disclaimer.
10
//
11
// 2. Redistributions in binary form must reproduce the above copyright notice,
12
// this list of conditions and the following disclaimer in the documentation
13
// and/or other materials provided with the distribution.
14
//
15
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
16
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
18
// APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
19
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
20
// DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
21
// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26
#if ! defined (LOG4CPLUS_HELPERS_LOCKFILE_H)
27
#define LOG4CPLUS_HELPERS_LOCKFILE_H
28
29
#include <
log4cplus/config.hxx
>
30
31
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
32
#pragma once
33
#endif
34
35
#include <
log4cplus/tstring.h
>
36
#include <
log4cplus/thread/syncprims.h
>
37
38
39
namespace
log4cplus
{
namespace
helpers {
40
41
42
class
LOG4CPLUS_EXPORT
LockFile
43
{
44
public
:
45
LockFile
(
tstring
const
& lock_file,
bool
create_dirs =
false
);
46
~LockFile
();
47
48
void
lock
()
const
;
49
void
unlock
()
const
;
50
51
private
:
52
void
open (
int
)
const
;
53
void
close ()
const
;
54
55
struct
Impl;
56
57
tstring
lock_file_name;
58
Impl * data;
59
bool
create_dirs;
60
};
61
62
63
typedef
log4cplus::thread::SyncGuard<LockFile>
LockFileGuard
;
64
65
66
} }
// namespace log4cplus { namespace helpers {
67
68
69
#endif // LOG4CPLUS_HELPERS_LOCKFILE_H
tstring.h
log4cplus
Definition:
appender.h:46
log4cplus::tstring
std::basic_string< tchar > tstring
Definition:
tstring.h:39
config.hxx
log4cplus::helpers::LockFile::~LockFile
~LockFile()
log4cplus::helpers::LockFile::LockFile
LockFile(tstring const &lock_file, bool create_dirs=false)
log4cplus::helpers::LockFile::lock
void lock() const
log4cplus::helpers::LockFile
Definition:
lockfile.h:43
LOG4CPLUS_EXPORT
#define LOG4CPLUS_EXPORT
Definition:
win32.h:141
log4cplus::helpers::LockFileGuard
log4cplus::thread::SyncGuard< LockFile > LockFileGuard
Definition:
lockfile.h:63
log4cplus::thread::SyncGuard
Definition:
syncprims.h:43
log4cplus::helpers::LockFile::unlock
void unlock() const
syncprims.h
Generated on Tue Nov 3 2020 17:38:12 for log4cplus by
1.8.18