Commit Graph

75 Commits

Author SHA1 Message Date
Robert Osfield
7bc373a056 Bumped SO_VERSION number of OpenThreads to avoid conflicts with Debian SO_VERSION bump 2014-01-07 16:18:05 +00:00
Robert Osfield
b3aa1bda1d Updated OpenThreads version to be in sync with OSG version 2013-07-19 17:00:24 +00:00
Robert Osfield
a64b412885 Reverted the usage of OSG_UNUSED and OT_UNUSED as in hindsight these should never have been merged. Adding code to quieten
inappropriate warnings is a bad programming practice and does not desrve a place in the OSG code base.
2013-07-01 08:21:13 +00:00
Robert Osfield
097aedf23c From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
Robert Osfield
bdfd18dc03 From Kristofer Tingdahl, with additions from Riccardo Corsi and Robert Milharcic, support for Qt5 build 2013-06-10 14:34:25 +00:00
Robert Osfield
1227f3f620 From Ulrich Hertlein, "as discussed on osg-users there is an issue with clang++ on OS X and iOS that results in
the following error:

Users/stephan/Documents/Projekte/cefix/cefix/ios/../../libs/ios/include/OpenThreads/Atomic:244:48:
error: cannot initialize a parameter of type 'void *' with an lvalue of
type 'const void *const'
   return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);

This can be solved by a cast to '(void*)ptrOld'.  This should be benign since both
'ptrOld' and 'ptrNew' are only read and the cast is in fact in place for all other
implementations as well.

On OS X the cast compiles cleanly on both g++ (i686-apple-darwin11-llvm-g++-4.2 (GCC)
4.2.1) and clang++ (Apple clang version 3.1 (tags/Apple/clang-318.0.54)).
"
2012-03-23 10:24:50 +00:00
Robert Osfield
8e2857905f Fixed warnings generated by clang,
src/osgAnimation/Skeleton.cpp:25:87: warning: addition of default argument on redeclaration makes this constructor a copy constructor [-Wdefault-arg-special-member]
Skeleton::UpdateSkeleton::UpdateSkeleton(const UpdateSkeleton& us, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) : osg::Object(us, copyop), osg::NodeCallback(us, copyop)

/src/OpenThreads/pthreads/PThread.cpp:1024:15: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
    if (cpunum<0) return -1;

src/osgDB/ExternalFileWriter.cpp:221:122: warning: expression result unused [-Wunused-value]
    _objects.insert(ObjectsSet::value_type(&obj, ObjectData(absoluteDestinationPath, relativeDestinationPath, written))).first;

src/osgManipulator/Dragger.cpp:175:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
        if (*itr = constraint) return;

src/osgManipulator/Dragger.cpp:187:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
        if (*itr = constraint)
2011-06-23 19:58:52 +00:00
Robert Osfield
9fee243b36 Updated OpenThreads version number for stable release 2011-06-17 11:02:40 +00:00
Robert Osfield
27d4d5e4b9 From John Cummings, "While testing recent OSG developer releases and the subversion trunk, I
have noticed that on my 64-bit Linux machines, all of the OSG libraries
get installed into the "lib64" directory as I would expect. However, the
OpenThreads library gets installed into the "lib" directory when
selecting "Build OpenThreads with Qt threading support." That is, with
the BUILD_OPENTHREADS_WITH_QT set to ON.

I am attaching the a fix for this issue in the file:

src/OpenThreads/qt/CMakeLists.txt

It simply adds ${LIB_POSTFIX} to the destination as in done with all
other CMakeLists.txt with libraries in OSG. I have tested it on both
32-bit and 64-bit Linux."
2011-06-16 16:00:33 +00:00
Robert Osfield
38a807ae6e Windows warning fixes 2011-06-16 15:57:40 +00:00
Robert Osfield
c32b72e8c5 Fixed Coverity reported issue. Issue is benign as all the member variables are initialized in after construction,
but I've moved this initialization into the constructor to make the code more managable.

CID 11686: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member cnt is not initialized in this constructor nor in any functions that it calls.
Non-static class member maxcnt is not initialized in this constructor nor in any functions that it calls.
Non-static class member phase is not initialized in this constructor nor in any functions that it calls.
2011-04-27 16:37:25 +00:00
Robert Osfield
718fa5b679 Fixed 2 Coverity reported issues. Both issues are benign, but I've addressed then as with the changes the
code is clean and more mantainable.

CID 11676: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member cancelMode is not initialized in this constructor nor in any functions that it calls.
Non-static class member cpunum is not initialized in this constructor nor in any functions that it calls.
Non-static class member detached is not initialized in this constructor nor in any functions that it calls.
Non-static class member isRunning is not initialized in this constructor nor in any functions that it calls.
Non-static class member stackSize is not initialized in this constructor nor in any functions that it calls.
Non-static class member threadPolicy is not initialized in this constructor nor in any functions that it calls.
Non-static class member threadPriority is not initialized in this constructor nor in any functions that it calls.
Non-static class member uniqueId is not initialized in this constructor nor in any functions that it calls.

CID 11564: Unsigned compared against 0 (NO_EFFECT)
This less-than-zero comparison of an unsigned value is never true. "cpunum < 0U".
2011-04-27 16:35:34 +00:00
Robert Osfield
42d893c426 From Mourad Boufarguine, "I gave projects folders in VS a try, it works for applications, plugins and examples but not for the osg core libraries.
Attached OsgMacroUtils.cmake is a tiny fix for this. OpenThreads is addressed seperately."
2011-03-10 14:44:49 +00:00
Robert Osfield
b24353b12c From Rafa Gaitan and Jorge Izquierdo, build support for Android NDK.
"- In order to build against GLES1 we execute:
$ mkdir build_android_gles1
$ cd build_android_gles1
$ cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF
-DDYNAMIC_OPENSCENEGRAPH=OFF -DANDROID_NDK=<path_to_android_ndk>/
-DOSG_GLES1_AVAILABLE=ON -DOSG_GL1_AVAILABLE=OFF
-DOSG_GL2_AVAILABLE=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DJ=2
-DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF
$ make
 If all is correct you will have and static OSG inside:
build_android_gles1/bin/ndk/local/armeabi.

- GLES2 is not tested/proved, but I think it could be possible build
it with the correct cmake flags.
- The flag -DJ=2 is used to pass to the ndk-build the number of
processors to speed up the building.
- make install is not yet supported."
2011-03-08 16:35:37 +00:00
Robert Osfield
99aeca003b Fixed indentation 2011-03-08 15:31:49 +00:00
Robert Osfield
4f44dc2b5e Changed all .c++ to .cpp's 2011-03-07 13:45:58 +00:00
Robert Osfield
d2c19014ac Deleted old makefile files that are no longer required now we have CMake 2010-12-23 10:45:43 +00:00
Robert Osfield
007c8b9df6 From Ulrich Hertlein (applied by Robert Osfield), "OpenThreads/win32/Win32Condition.h is not used anymore and could be removed from the
repository and win32/OpenThreads.mak and win32/CMakeLists.txt."
2010-12-23 10:05:55 +00:00
Robert Osfield
56a8df7ba7 Improved indentation to make it more readable and consistent with OSG. 2010-12-21 10:23:31 +00:00
Robert Osfield
65aee287e7 From Mathias Froehlich, "Attached are most of the fixes that are required to build osg on solaris and
hpux. I have skipped irix this time as irix is too dead to keep osg building
there.

As usual, solaris does not like member templates in stl containers.
Some headers missing and link problems due to missing libraries."
2010-12-02 14:13:54 +00:00
Robert Osfield
297be2290a From Wang Rui, warning fix. 2010-10-14 12:20:51 +00:00
Robert Osfield
82c01cb72e From Wang Rui, QT based OpenThreads implementation 2010-10-14 09:31:09 +00:00
Robert Osfield
effd8919ad From Stephan Huber,
"changed the CmakeFiles for OpenThreads and the
osg-frameworks, so they are versioned by OPENSCENEGRAPH_SOVERSION. "

And from a later email:

"Attached you'll find a fixed version of ModulInstall.cmake. Hopefully it
works for old CMake-versions. I removed the offending line, and the
compile went fine on my end."
2010-07-31 08:57:52 +00:00
Robert Osfield
bca82dffcd Fixed permissions 2010-06-03 16:01:25 +00:00
Robert Osfield
c3bc3e5394 Removed redundent makefiles 2010-06-03 16:00:28 +00:00
Robert Osfield
12a0b9ab6d From Bernardt Duvenhage: "I noticed that in 'src/OpenThreads/pthreads/CMakeLists.txt' a '!' has been written instead of 'NOT' within an if statement expression.
IF(!OSG_COMPILE_FRAMEWORKS) ...
vs.
IF(NOT OSG_COMPILE_FRAMEWORKS) ...

This has the effect of always compiling OpenThreads as a framework under OSX. The CMakeLists.txt that I use to be able to compile the non-framework version of OpenThreads is attached. I simply replaced the '!' replaced by a 'NOT' and added a MESSAGE to notify me when the .framework will be compiled."
2010-04-29 15:23:43 +00:00
Robert Osfield
f67942cf03 From Alok Priyadashi, "The attached patch fixes
- compile errors on windows when compiled with UNICODE flag
- warnings for duplicate WIN32_LEAN_AND_MEAN. I think this should
better fixed by adding WIN32_LEAN_AND_MEAN to vcproj preprocessor
list."
2010-04-22 16:01:38 +00:00
Robert Osfield
c091b5c2d1 From Stephan Huber and Mathieu Marache, "attached you'll find framework support for os x via cmake. Please credit
Mathieu Marache, he added the last missing piece to this puzzle.

I think it is safe to commit these changes to trunk, as the traditional
way via dylibs should work as before.

Here's some more info how to get frameworks:

With these modifications it is possible to compile frameworks on OS X,
when you set the Cmake-option OSG_COMPILE_FRAMEWORKS to true. If you
want to embed the frameworks in your app-bundle make sure to set
OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR accordingly.

You'll have to build the install-target of the generated xcode-projects
as this sets the install_name_dirs of the frameworks and plugins."
2010-04-19 13:44:42 +00:00
Robert Osfield
9d35ec1631 Added a compile test for pthread_setaffinity_np to workaround problem with the FreeBSD pthread lib containing the function but the pthread.h header not containing it. 2010-03-24 17:12:05 +00:00
Robert Osfield
bafe1d0b94 Added automatic updating of the OpenThreads version number from the CMake version numbers 2010-03-10 09:37:04 +00:00
Robert Osfield
a023250d07 From Mourad Boufarguine, fixed typo. 2010-02-18 22:20:11 +00:00
Robert Osfield
424183dd0e Updated version number of OpenThreads to reflect recent changes 2010-02-18 21:24:42 +00:00
Robert Osfield
787daeeb93 Refactored the ReentrantMutex support so that it utilises the underling thread implementation for recusive mutex support. 2010-02-18 20:14:41 +00:00
Robert Osfield
f45ae6a4d8 From David Fries, "I was trying to create a lot of threads under 32 bit Linux, but could
only create 376, then the program would hang.
376 * 8MB stack per thread = 3008 MB
The stack size allocated per thread blew the process address stack.
To get more threads you have to specify a smaller per thread stack,
but while the Thread::start says it will limit the stack size to the
smallest allowable stack size, it won't let it be smaller than the
default.  I included the limits.h header to use PTHREAD_STACK_MIN as
the minimum stack size.

As for the deadlock, if the pthread_create failed, the new thread
doesn't exist and doesn't call threadStartedBlock.release(), so the
existing thread deadlocks on threadStartedBlock.block().  Only block
if the thread was started."
2009-11-20 10:27:43 +00:00
Robert Osfield
fcb94de7ed From Donn Mielcarek, "I'm surprised this hasn't come up before, but the function Thread::setProcessorAffinity
always returns -1, even if the call is successful.  I added return
statements to each of the function calls."
2009-11-19 17:18:22 +00:00
Robert Osfield
258d702d02 Fixed tabs 2009-11-19 17:17:24 +00:00
Robert Osfield
058d31d7b5 From Mathias Froehlich, "Tha attached change adapt previous attemps to get our application using osg
through microsofts application verifier. The current change should work a
little better ...
The change is based on rev 10605."
2009-10-10 11:00:35 +00:00
Robert Osfield
9aa6d33980 From David Fries, "Comparing the win32 barrier to the pthread barrier, win32 puts the
while in an else clause.  When if is true the phase changes and the
while condition will always by false, so might as well put the while
in the else to skip the check.  There's also a benefit to having the
code logic similar between platforms.
"
2009-07-13 16:14:43 +00:00
Robert Osfield
3983f38f18 From David Fries, "Here is a fix for a deadlock seen under Windows using OpenThreads
Barrier operations.  The error is with atomic operations in the
win32 condition implementation.  The attached sample program will
reliably trigger with as few as three threads and a dual core system,
though sometimes it will take 65,000 iterations.

2.8.1 was the base for these changes

Win32ConditionPrivateData.h
Win32ConditionPrivateData::wait does two operations to decrement
waiters_ then read, when InterlockedDecrement decrements and returns
the value in one operation.  The two operations allows another thread
to also decrement with both getting 0 for an answer.

Win32ConditionPrivateData::broadcast is using waiters_ directly
instead of using the w value read earlier, if it was safe to use
waiters_ directly there would be no need for InterlockedGet or w.

overview of deadlock in barrier with three threads
one thread in broadcast, 2 threads in wait,
release semaphore 2, waits on waiters_done_
both threads wake, decrement waiters_, get 0 for w,
       <logic error here>
one calls set waiters_done_,
broadcast thread comes out of waiters_done_,
other thread calls waiters_done_, (which leaves waiters_done_ in the
signaled state)
       <sets the trap>
broadcast thread returns releases mutex, other threads get
mutex and also return,
next barrier, first two threads enter wait, one goes to broadcast, release
semaphore 2, skips waiters_done_ as it had been released last time
returns, processes, enters the barrier for the next barrier operation
and waits,
three threads are now in wait, two have the previous barrier phase,
one the current phase, there's one count left in the semaphore which a
thread gets, returns, enters the barrier as a waiter, sleeps, and the
deadlock is completed"
2009-07-13 16:05:57 +00:00
Robert Osfield
a4cc72d4fb Removed redundant errno declaration that was cause build problems under RedHat 3.2.
Removed redundant version declarations.
2009-05-15 12:22:53 +00:00
Robert Osfield
0cf92badba From Thibault Genessay, "On Windows, when a process tries to spawn one too many thread,
_beginthreadex() fails but OpenThreads still waits on the startup
Block before returning to the caller of OpenThreads::Thread::start().
This causes a deadlock. The return value of _beginthreadex() is
actually checked, but after the call to OpenThreads::Block::block() so
it is basically useless.

Attached is a fix to move the check for the return value of
_beginthreadex() before the call to block(), so that start() can
return to the caller with a non-zero error code. This solves the
problem for me."
2009-05-13 08:33:55 +00:00
Robert Osfield
e89deb0f79 From Csaba Halasz, "IIRC the C++ standard says members will be initialized in declaration
order, and not in the order they are listed in the constructor. To
avoid possible trouble, gcc warns about this. Attached modification
fixes the initializer order to silence this warning."
2009-03-23 16:28:48 +00:00
Robert Osfield
3dbda7e9bc From Csaba Halasz, "I have removed some unnecessary semicolons that mingw build warns about." 2009-03-23 16:21:51 +00:00
Robert Osfield
39cecd2a72 From Philip Lowman, "Here's the promised cleanup of the OSG's CMakeLists.txt files for the src/ folder. I'll submit the others separately.
Also, there was also a small bug in osgDB's CMakeLists.txt that was causing an error when I tested with CMake 2.4.4.

IF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime")
was changed to
IF(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX STREQUAL "quicktime")
"
2009-03-23 16:01:02 +00:00
Robert Osfield
48c8402c1c From Mathias Froehlich, "An other one:
The TLS Varialbe is accessed before it is initialized.
Attached is a change to rev 9791."
2009-03-02 10:49:29 +00:00
Robert Osfield
055801d57c From Mattias Helsing, "Here is a fix for the "Unspecified" package. The openthreads pkgconfig
file is made part of libopenthreads-dev component.

Attached is the modded cmakelists.txt for src/OpenThreads/
"
2009-02-19 15:15:39 +00:00
Robert Osfield
ed747fc789 Added brackets around (unsigned int) to avoid IRIX compile error. 2009-02-11 12:10:52 +00:00
Robert Osfield
e63e19bed4 Fixed path to version resource input file 2009-02-06 14:19:14 +00:00
Robert Osfield
75f0e64cc7 Added support for VS versioning of OpenThreads 2009-02-06 08:46:02 +00:00
Robert Osfield
316a7a4dbd Removed cast, to quieten VS warnings. Confirm change with original author Mathias Froehlich. 2009-02-04 09:03:13 +00:00