thread-config.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.
  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. # define LOG4CPLUS_USE_SRW_LOCK
  33. //# define LOG4CPLUS_POOR_MANS_SHAREDMUTEX
  34. # undef LOG4CPLUS_HAVE_TLS_SUPPORT
  35. # undef LOG4CPLUS_THREAD_LOCAL_VAR
  36. # if defined (_MSC_VER)
  37. // The __declspec(thread) functionality is not compatible with LoadLibrary().
  38. // For more information why see and "Windows and TLS" note in README.
  39. // <http://msdn.microsoft.com/en-us/library/2s9wt68x(v=vs.100).aspx>.
  40. # define LOG4CPLUS_HAVE_TLS_SUPPORT 1
  41. # define LOG4CPLUS_THREAD_LOCAL_VAR __declspec(thread)
  42. # endif
  43. #elif defined(LOG4CPLUS_SINGLE_THREADED)
  44. # undef LOG4CPLUS_HAVE_TLS_SUPPORT
  45. # undef LOG4CPLUS_THREAD_LOCAL_VAR
  46. #else
  47. # error "You Must define a Threading model"
  48. #endif
  49. #endif // LOG4CPLUS_HELPERS_THREAD_CONFIG_HEADER_