fix posix memory release issues

fix compile problems on Mac OSX
reduce shared memory size on Mac (>512*1024 fails to allocate)
This commit is contained in:
Erwin Coumans
2018-05-02 15:39:16 -07:00
parent 1f6afcda30
commit 4a8ad1a54e
9 changed files with 45 additions and 9 deletions

View File

@@ -21,7 +21,7 @@
void SampleThreadFunc(void* userPtr,void* lsMemory);
void* SamplelsMemoryFunc();
void SamplelsMemoryReleaseFunc(void* ptr);
#include <stdio.h>
//#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);
@@ -47,7 +48,7 @@ b3ThreadSupportInterface* createThreadSupport(int numThreads)
b3ThreadSupportInterface* createThreadSupport(int numThreads)
{
b3Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("testThreads",SampleThreadFunc,SamplelsMemoryFunc,numThreads);
b3Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("testThreads",SampleThreadFunc,SamplelsMemoryFunc,SamplelsMemoryReleaseFunc,numThreads);
b3Win32ThreadSupport* threadSupport = new b3Win32ThreadSupport(threadConstructionInfo);
return threadSupport;
@@ -155,7 +156,11 @@ void* SamplelsMemoryFunc()
return new SampleThreadLocalStorage;
}
void SamplelsMemoryReleaseFunc(void* ptr)
{
SampleThreadLocalStorage* p = (SampleThreadLocalStorage*) ptr;
delete p;
}