Fix stack overflow on mac when cooking game with too small stack size
This commit is contained in:
@@ -535,7 +535,8 @@ bool GameCooker::Build(BuildPlatform platform, BuildConfiguration configuration,
|
|||||||
{
|
{
|
||||||
Function<int32()> f;
|
Function<int32()> f;
|
||||||
f.Bind(ThreadFunction);
|
f.Bind(ThreadFunction);
|
||||||
const auto thread = ThreadSpawner::Start(f, GameCookerServiceInstance.Name, ThreadPriority::Highest);
|
uint32 stackSize = 4 * 1024 * 1024; // Larger stack
|
||||||
|
const auto thread = ThreadSpawner::Start(f, GameCookerServiceInstance.Name, ThreadPriority::Highest, stackSize);
|
||||||
if (thread == nullptr)
|
if (thread == nullptr)
|
||||||
{
|
{
|
||||||
GameCookerImpl::IsRunning = false;
|
GameCookerImpl::IsRunning = false;
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ public:
|
|||||||
/// <param name="callback">The callback function.</param>
|
/// <param name="callback">The callback function.</param>
|
||||||
/// <param name="threadName">Name of the thread.</param>
|
/// <param name="threadName">Name of the thread.</param>
|
||||||
/// <param name="priority">The thread priority.</param>
|
/// <param name="priority">The thread priority.</param>
|
||||||
|
/// <param name="stackSize">The size of the stack to create. 0 means use the current thread's stack size</param>
|
||||||
/// <returns>The created thread.</returns>
|
/// <returns>The created thread.</returns>
|
||||||
static Thread* Start(const Function<int32()>& callback, const String& threadName, ThreadPriority priority = ThreadPriority::Normal)
|
static Thread* Start(const Function<int32()>& callback, const String& threadName, ThreadPriority priority = ThreadPriority::Normal, uint32 stackSize = 0)
|
||||||
{
|
{
|
||||||
auto runnable = New<SimpleRunnable>(true);
|
auto runnable = New<SimpleRunnable>(true);
|
||||||
runnable->OnWork = callback;
|
runnable->OnWork = callback;
|
||||||
return Thread::Create(runnable, threadName, priority);
|
return Thread::Create(runnable, threadName, priority, stackSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user