log4cplus  2.1.0
thread-config.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Module: Log4CPLUS
3 // File: thread-config.h
4 // Created: 4/2003
5 // Author: Tad E. Smith
6 //
7 //
8 // Copyright 2003-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.
23 #ifndef LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_
24 #define LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_
25 
26 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
27 #pragma once
28 #endif
29 
30 #if defined (LOG4CPLUS_USE_PTHREADS)
31 # if defined (__APPLE__)
32 # define LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE
33 # endif
34 
35 #elif defined(LOG4CPLUS_USE_WIN32_THREADS)
36 # define LOG4CPLUS_USE_SRW_LOCK
37 //# define LOG4CPLUS_POOR_MANS_SHAREDMUTEX
38 # undef LOG4CPLUS_HAVE_TLS_SUPPORT
39 # undef LOG4CPLUS_THREAD_LOCAL_VAR
40 # if defined (_MSC_VER)
41 // The __declspec(thread) functionality is not compatible with LoadLibrary().
42 // For more information why see and "Windows and TLS" note in README.
43 // <http://msdn.microsoft.com/en-us/library/2s9wt68x(v=vs.100).aspx>.
44 # define LOG4CPLUS_HAVE_TLS_SUPPORT 1
45 # define LOG4CPLUS_THREAD_LOCAL_VAR __declspec(thread)
46 # endif
47 
48 #elif defined(LOG4CPLUS_SINGLE_THREADED)
49 # undef LOG4CPLUS_HAVE_TLS_SUPPORT
50 # undef LOG4CPLUS_THREAD_LOCAL_VAR
51 
52 #else
53 # error "You Must define a Threading model"
54 
55 #endif
56 
57 
58 #endif // LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_