log4cplus
1.1.0
|
00001 // -*- C++ -*- 00002 // Module: Log4CPLUS 00003 // File: thread-config.h 00004 // Created: 4/2003 00005 // Author: Tad E. Smith 00006 // 00007 // 00008 // Copyright 2003-2010 Tad E. Smith 00009 // 00010 // Licensed under the Apache License, Version 2.0 (the "License"); 00011 // you may not use this file except in compliance with the License. 00012 // You may obtain a copy of the License at 00013 // 00014 // http://www.apache.org/licenses/LICENSE-2.0 00015 // 00016 // Unless required by applicable law or agreed to in writing, software 00017 // distributed under the License is distributed on an "AS IS" BASIS, 00018 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 // See the License for the specific language governing permissions and 00020 // limitations under the License. 00023 #ifndef LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ 00024 #define LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_ 00025 00026 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 00027 #pragma once 00028 #endif 00029 00030 #if defined (LOG4CPLUS_USE_PTHREADS) 00031 # if defined (__APPLE__) 00032 # define LOG4CPLUS_USE_NAMED_POSIX_SEMAPHORE 00033 # endif 00034 00035 #elif defined(LOG4CPLUS_USE_WIN32_THREADS) 00036 # if defined (_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 00037 # define LOG4CPLUS_USE_SRW_LOCK 00038 # else 00039 # define LOG4CPLUS_POOR_MANS_SHAREDMUTEX 00040 # endif 00041 # undef LOG4CPLUS_HAVE_TLS_SUPPORT 00042 # undef LOG4CPLUS_THREAD_LOCAL_VAR 00043 # if defined (_MSC_VER) && _WIN32_WINNT >= 0x0600 00044 // The __declspec(thread) functionality is not compatible with LoadLibrary(). 00045 // For more information why see and "Windows and TLS" note in README. 00046 // <http://msdn.microsoft.com/en-us/library/2s9wt68x(v=vs.100).aspx>. 00047 # define LOG4CPLUS_HAVE_TLS_SUPPORT 1 00048 # define LOG4CPLUS_THREAD_LOCAL_VAR __declspec(thread) 00049 # endif 00050 00051 #elif defined(LOG4CPLUS_SINGLE_THREADED) 00052 # undef LOG4CPLUS_HAVE_TLS_SUPPORT 00053 # undef LOG4CPLUS_THREAD_LOCAL_VAR 00054 00055 #else 00056 # error "You Must define a Threading model" 00057 00058 #endif 00059 00060 00061 #endif // LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_