Guest User

Mac OSX patch for Povray 3.7beta40

a guest
Dec 21st, 2010
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. diff -uwr original/povray-3.7.0.beta.40/source/backend/frame.h new/povray-3.7.0.beta.40/source/backend/frame.h
  2. --- original/povray-3.7.0.beta.40/source/backend/frame.h 2010-12-06 12:55:33.000000000 +0100
  3. +++ new/povray-3.7.0.beta.40/source/backend/frame.h 2010-12-21 23:42:36.000000000 +0100
  4. @@ -96,6 +96,9 @@
  5.  
  6. // Generic header for all modules
  7.  
  8. +#include <pthread.h>
  9. +
  10. +
  11. #include <new>
  12.  
  13. #include <stdio.h>
  14. @@ -1898,10 +1901,48 @@
  15. // you'll need to fix your platform-specific config to provide a means to declare
  16. // thread-local variables. support for TLS is required for efficient access by the
  17. // render threads to their stats and cache data.
  18. +
  19. +
  20. #ifndef DECLARE_THREAD_LOCAL_PTR
  21. -#define DECLARE_THREAD_LOCAL_PTR(ptrType, ptrName) __thread ptrType *ptrName;
  22. -#endif
  23. +#ifdef __APPLE__
  24. +template<typename T>
  25. +class Pthread_Thread_Local_Pointer
  26. +{
  27. + public:
  28. + Pthread_Thread_Local_Pointer()
  29. + {
  30. + pthread_key_create(&m_key, NULL);
  31. + }
  32. +
  33. + Pthread_Thread_Local_Pointer& operator=(T* ptr)
  34. + {
  35. + pthread_setspecific(m_key, ptr);
  36. + return *this;
  37. + };
  38.  
  39. + bool operator!=(T* rhs)
  40. + {
  41. + return pthread_getspecific(m_key) != rhs;
  42. + }
  43. +
  44. + T* operator->() const
  45. + {
  46. + return static_cast<T*>(pthread_getspecific(m_key));
  47. + }
  48. +
  49. + operator T*() const
  50. + {
  51. + return static_cast<T*>(pthread_getspecific(m_key));
  52. + }
  53. +
  54. + private:
  55. + pthread_key_t m_key;
  56. +};
  57. +#define DECLARE_THREAD_LOCAL_PTR(ptrType, ptrName) Pthread_Thread_Local_Pointer<ptrType> ptrName;
  58. +#else
  59. +#efine DECLARE_THREAD_LOCAL_PTR(ptrType, ptrName) __thread ptrType *ptrName;
  60. +#endif
  61. +#endif
  62. }
  63.  
  64. #endif
  65. diff -uwr original/povray-3.7.0.beta.40/vfe/vfesession.h new/povray-3.7.0.beta.40/vfe/vfesession.h
  66. --- original/povray-3.7.0.beta.40/vfe/vfesession.h 2010-12-06 12:55:33.000000000 +0100
  67. +++ new/povray-3.7.0.beta.40/vfe/vfesession.h 2010-12-21 22:36:54.000000000 +0100
  68. @@ -94,6 +94,8 @@
  69. #ifndef __VFESESSION_H__
  70. #define __VFESESSION_H__
  71.  
  72. +#include <sys/types.h>
  73. +
  74. #include <queue>
  75.  
  76. namespace vfe
Advertisement
Add Comment
Please, Sign In to add comment