Commit Graph

11 Commits

Author SHA1 Message Date
Robert Osfield
3b8802c5aa From Piotr Domagalski, "Currently, code using OpenSceneGraph doesn't build with clang due to the way __sync_bool_compare_and_swap() is used in OpenThreads/Atomic header file.
I tested it with clang 3.1 and it seems that clang is enforcing the use of the same type for all parameters in this builtin. Looking at the function declaration [1]

bool __sync_bool_compare_and_swap (type *ptr, type oldval type newval, ...)

it seems to be doing the right thing: here the same type is used for *ptr, oldval and newval.

[1] http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins
"
2012-09-06 10:52:28 +00:00
Robert Osfield
a0479bdb21 From Chuck Seberino, (submitted by Stephan Huber) Chuck's original message : "I have a patch to submit that fixes the following error when building against OSX 10.6.2." 2010-01-07 17:20:55 +00:00
Robert Osfield
e9c406a303 Fixed spacing 2009-11-19 16:53:29 +00:00
Robert Osfield
95ebf1fe71 From Andy Skinner, "I added a const_cast for a call to atomic_cas_ptr, which takes a void* and has been given a const void* const." 2009-01-08 11:16:56 +00:00
Robert Osfield
5275c11d06 From Blasius Czink, "It seems there is no atomic_xor_uint_nv(). I
attached a changed version of the Atomic header where a mutex fallback
is used for "xor" on solaris."
2009-01-08 11:15:14 +00:00
Robert Osfield
d703c58936 From Blasius Czink, "Among other things I added support for atomic operations on BSD-like systems and additional methods (for "and", "or", "xor").
"

and a later post the same osg-submissions thread:

"it's been a while since I have made the changes but I think it was due to problems with static builds of OpenThreads on windows. I was using
OpenThreads in a communication/synchronisation library (without
OpenSceneGraph). It seems I forgot to post a small change in the CMakeLists file of OpenThreads. If a user turns DYNAMIC_OPENTHREADS to OFF (static build) OT_LIBRARY_STATIC will be defined in the Config.
Without these changes a windows user will always end up with a "__declspec(dllexport)" or "__declspec(dllimport)" which is a problem for static builds."

And another post from Blasius on this topic:

"I tested with VS2005 and VS2008. For 32 bit everything works as expected. For x64 and VS2008 I could successfully do the cmake-configure and then the compilation but I had occasional crashes of cmTryCompileExec.exe (during the cmake-configure phase) which seems to be a cmake bug. With VS2005 and 64bit cmake does not set _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED although the interlocked functionality should be there. If I place the source snippet from the CHECK_CXX_SOURCE_RUNS macro to a separate sourcefile I can compile and run the resulting executable successfully. Forcing OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED (on VS2005/x64) reveals a bug in "intrin.h" which seems to be fixed in VS2008 but not in VS2005.

In case anyone is interested the lines:
__MACHINEI(unsigned char _interlockedbittestandset(long *a, long b))
__MACHINEI(unsigned char _interlockedbittestandreset(long *a, long b))
__MACHINEX64(unsigned char _interlockedbittestandset64(__int64 *a, __int64 b))
__MACHINEX64(unsigned char _interlockedbittestandreset64(__int64 *a, __int64 b))

should be changed to:
__MACHINEI(unsigned char _interlockedbittestandset(long volatile *a, long b))
__MACHINEI(unsigned char _interlockedbittestandreset(long volatile *a, long b))
__MACHINEX64(unsigned char _interlockedbittestandset64(__int64 volatile *a, __int64 b))
__MACHINEX64(unsigned char _interlockedbittestandreset64(__int64 volatile *a, __int64 b))

The worst thing that can happen is that interlocked funtionality is not detected during cmake-configure and the mutex fallback is used.
Which reminds me another small glitch in the Atomic header so I attached a corrected version.



    Why is the OT_LIBRARY_STATIC added to the config file? It is not needed anywhere.

OT_LIBRARY_STATIC is needed if you are doing static-builds on Windows. See my previous post on that.
"
2008-10-27 10:42:58 +00:00
Robert Osfield
5a4ce5a387 From Mathias Froechlich, "Attached is a change to that atomic stuff to move the win32, msvc
implementation of the atomic increment and decrement into a implementation
file.
This way inlining and compiler optimization can no longer happen for these
implementations, but it fixes compilation on win32 msvc targets. I expect
that this is still faster than with with mutexes.

Also the i386 gcc target gets atomic operations with this patch. By using an
implementation file we can guarantee that we have the right compiler flags
available."
2008-06-26 10:27:16 +00:00
Robert Osfield
0b6e605795 From Mathias Froehlich, "fixed win32/win64 configure check and win32/win64
atomic related compile failures with msvs2005. Attached changes to make win32
really use the atomic stuff. There are pointer typecast problems and some
historic alignment restrictions that I just took from a previous similar
implementation of mine without looking deep enough. "
2008-06-23 14:51:34 +00:00
Robert Osfield
3672ba51e7 From Melchior Franz, fixed typo on variable name 2008-06-20 09:46:45 +00:00
Robert Osfield
4c9b3de4a1 Updated wrappers to fix OpenThreads::Atomic build issues. 2008-06-19 13:28:33 +00:00
Robert Osfield
d7e9e5e495 From Mathias Froehlich, OpenThreads::Atomic support 2008-06-17 17:43:59 +00:00