From 46a7fbe92f8779cbd006107c2a20890fd8cbaf5b Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Wed, 20 Nov 2019 17:06:05 -0800 Subject: [PATCH 1/2] fix old threading examples --- examples/MultiThreading/MultiThreadingExample.cpp | 9 +++++---- examples/MultiThreading/main.cpp | 10 +++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/MultiThreading/MultiThreadingExample.cpp b/examples/MultiThreading/MultiThreadingExample.cpp index c63a0b363..b9701fb7e 100644 --- a/examples/MultiThreading/MultiThreadingExample.cpp +++ b/examples/MultiThreading/MultiThreadingExample.cpp @@ -29,13 +29,14 @@ void SamplelsMemoryReleaseFunc(void* ptr); #ifndef _WIN32 #include "b3PosixThreadSupport.h" + b3ThreadSupportInterface* createThreadSupport(int numThreads) { b3PosixThreadSupport::ThreadConstructionInfo constructionInfo("testThreads", - SampleThreadFunc, - SamplelsMemoryFunc, - SamplelsMemoryReleaseFunc, - numThreads); + SampleThreadFunc, + SamplelsMemoryFunc, + SamplelsMemoryReleaseFunc, + numThreads); b3ThreadSupportInterface* threadSupport = new b3PosixThreadSupport(constructionInfo); return threadSupport; diff --git a/examples/MultiThreading/main.cpp b/examples/MultiThreading/main.cpp index f2dcd13dc..561f17c21 100644 --- a/examples/MultiThreading/main.cpp +++ b/examples/MultiThreading/main.cpp @@ -22,7 +22,7 @@ subject to the following restrictions: void SampleThreadFunc(void* userPtr, void* lsMemory); void* SamplelsMemoryFunc(); - +void SamplelsMemoryReleaseFunc(void* ptr); #include //#include "BulletMultiThreaded/PlatformDefinitions.h" @@ -34,6 +34,7 @@ b3ThreadSupportInterface* createThreadSupport(int numThreads) b3PosixThreadSupport::ThreadConstructionInfo constructionInfo("testThreads", SampleThreadFunc, SamplelsMemoryFunc, +SamplelsMemoryReleaseFunc, numThreads); b3ThreadSupportInterface* threadSupport = new b3PosixThreadSupport(constructionInfo); @@ -99,6 +100,13 @@ void* SamplelsMemoryFunc() return new SampleThreadLocalStorage; } +void SamplelsMemoryReleaseFunc(void* ptr) +{ + SampleThreadLocalStorage* p = (SampleThreadLocalStorage*)ptr; + delete p; +} + + int main(int argc, char** argv) { int numThreads = 8; From 824fd6410f6e1499edca5c676f807fff5dd40543 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 21 Nov 2019 19:07:11 -0800 Subject: [PATCH 2/2] Use -> Set in API --- examples/SharedMemory/PhysicsClientC_API.cpp | 2 +- examples/SharedMemory/PhysicsClientC_API.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/SharedMemory/PhysicsClientC_API.cpp b/examples/SharedMemory/PhysicsClientC_API.cpp index 611a75655..2aed031a5 100644 --- a/examples/SharedMemory/PhysicsClientC_API.cpp +++ b/examples/SharedMemory/PhysicsClientC_API.cpp @@ -386,7 +386,7 @@ B3_SHARED_API int b3LoadSoftBodySetCollisionHardness(b3SharedMemoryCommandHandle return 0; } -B3_SHARED_API int b3LoadSoftBodyUseSelfCollision(b3SharedMemoryCommandHandle commandHandle, int useSelfCollision) +B3_SHARED_API int b3LoadSoftBodySetSelfCollision(b3SharedMemoryCommandHandle commandHandle, int useSelfCollision) { struct SharedMemoryCommand* command = (struct SharedMemoryCommand*)commandHandle; b3Assert(command->m_type == CMD_LOAD_SOFT_BODY); diff --git a/examples/SharedMemory/PhysicsClientC_API.h b/examples/SharedMemory/PhysicsClientC_API.h index 220e5582f..4b744c12e 100644 --- a/examples/SharedMemory/PhysicsClientC_API.h +++ b/examples/SharedMemory/PhysicsClientC_API.h @@ -639,7 +639,7 @@ extern "C" B3_SHARED_API int b3LoadSoftBodyAddMassSpringForce(b3SharedMemoryCommandHandle commandHandle, double springElasticStiffness , double springDampingStiffness); B3_SHARED_API int b3LoadSoftBodyAddGravityForce(b3SharedMemoryCommandHandle commandHandle, double gravityX, double gravityY, double gravityZ); B3_SHARED_API int b3LoadSoftBodySetCollisionHardness(b3SharedMemoryCommandHandle commandHandle, double collisionHardness); - B3_SHARED_API int b3LoadSoftBodyUseSelfCollision(b3SharedMemoryCommandHandle commandHandle, int useSelfCollision); + B3_SHARED_API int b3LoadSoftBodySetSelfCollision(b3SharedMemoryCommandHandle commandHandle, int useSelfCollision); B3_SHARED_API int b3LoadSoftBodyUseFaceContact(b3SharedMemoryCommandHandle commandHandle, int useFaceContact); B3_SHARED_API int b3LoadSoftBodySetFrictionCoefficient(b3SharedMemoryCommandHandle commandHandle, double frictionCoefficient); B3_SHARED_API int b3LoadSoftBodyUseBendingSprings(b3SharedMemoryCommandHandle commandHandle, int useBendingSprings);