log4cplus
2.1.0
include
log4cplus
thread
impl
threads-impl.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
// Module: Log4CPLUS
3
// File: threads.h
4
// Created: 6/2001
5
// Author: Tad E. Smith
6
//
7
//
8
// Copyright 2001-2017 Tad E. Smith
9
//
10
// Licensed under the Apache License, Version 2.0 (the "License");
11
// you may not use this file except in compliance with the License.
12
// You may obtain a copy of the License at
13
//
14
// http://www.apache.org/licenses/LICENSE-2.0
15
//
16
// Unless required by applicable law or agreed to in writing, software
17
// distributed under the License is distributed on an "AS IS" BASIS,
18
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
// See the License for the specific language governing permissions and
20
// limitations under the License.
21
24
#ifndef LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_
25
#define LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_
26
27
#include <
log4cplus/config.hxx
>
28
29
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
30
#pragma once
31
#endif
32
33
#if defined (_WIN32)
34
#include <
log4cplus/config/windowsh-inc.h
>
35
#endif
36
#include <
log4cplus/tstring.h
>
37
#include <
log4cplus/helpers/pointer.h
>
38
#include <
log4cplus/thread/threads.h
>
39
40
#if ! defined (INSIDE_LOG4CPLUS)
41
# error "This header must not be be used outside log4cplus' implementation files."
42
#endif
43
44
45
namespace
log4cplus
{
namespace
thread {
namespace
impl {
46
47
48
#if defined (LOG4CPLUS_USE_PTHREADS)
49
50
typedef
pthread_t os_handle_type;
51
typedef
pthread_t os_id_type;
52
53
54
inline
55
pthread_t
56
getCurrentThreadId ()
57
{
58
return
pthread_self ();
59
}
60
61
62
#elif defined (LOG4CPLUS_USE_WIN32_THREADS)
63
64
typedef
HANDLE os_handle_type;
65
typedef
DWORD os_id_type;
66
67
68
inline
69
DWORD
70
getCurrentThreadId ()
71
{
72
return
GetCurrentThreadId ();
73
}
74
75
76
#elif defined (LOG4CPLUS_SINGLE_THREADED)
77
78
typedef
void
* os_handle_type;
79
typedef
int
os_id_type;
80
81
82
inline
83
int
84
getCurrentThreadId ()
85
{
86
return
1;
87
}
88
89
90
#endif
91
92
93
} } }
// namespace log4cplus { namespace thread { namespace impl {
94
95
96
#endif
// LOG4CPLUS_IMPL_THREADS_IMPL_HEADER_
config.hxx
log4cplus
Definition:
appender.h:46
pointer.h
threads.h
tstring.h
windowsh-inc.h
Generated on Tue Feb 28 2023 19:27:01 for log4cplus by
1.9.1