You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB

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