mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
ThreadPool.MaxStackSize
This commit is contained in:
parent
a1d952b404
commit
8942c86eb5
2 changed files with 10 additions and 3 deletions
|
@ -148,7 +148,7 @@ namespace System.Threading
|
||||||
SetStart((Delegate)start, 0); //0 will setup Thread with default stackSize
|
SetStart((Delegate)start, 0); //0 will setup Thread with default stackSize
|
||||||
}
|
}
|
||||||
|
|
||||||
public this(ThreadStart start, int32 maxStackSize)
|
public this(ThreadStart start, int maxStackSize)
|
||||||
{
|
{
|
||||||
if (start == null)
|
if (start == null)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ namespace System.Threading
|
||||||
}
|
}
|
||||||
if (0 > maxStackSize)
|
if (0 > maxStackSize)
|
||||||
Runtime.FatalError();
|
Runtime.FatalError();
|
||||||
SetStart((Delegate)start, maxStackSize);
|
SetStart((Delegate)start, (.)maxStackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public this(ParameterizedThreadStart start)
|
public this(ParameterizedThreadStart start)
|
||||||
|
|
|
@ -40,8 +40,15 @@ namespace System.Threading
|
||||||
|
|
||||||
static ThreadStats sWorkerThreadStats;
|
static ThreadStats sWorkerThreadStats;
|
||||||
static ThreadStats sIOThreadStats;
|
static ThreadStats sIOThreadStats;
|
||||||
|
static int sMaxStackSize;
|
||||||
static List<WorkEntry> mWorkEntries = new List<WorkEntry>() ~ delete _;
|
static List<WorkEntry> mWorkEntries = new List<WorkEntry>() ~ delete _;
|
||||||
|
|
||||||
|
public static int MaxStackSize
|
||||||
|
{
|
||||||
|
get => sMaxStackSize;
|
||||||
|
set => sMaxStackSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
{
|
{
|
||||||
//TODO: This is really bad, fix this pool!
|
//TODO: This is really bad, fix this pool!
|
||||||
|
@ -76,7 +83,7 @@ namespace System.Threading
|
||||||
sWorkerThreadStats.mCount++;
|
sWorkerThreadStats.mCount++;
|
||||||
sWorkerThreadStats.mActive++; // We know the thread will immediately become active
|
sWorkerThreadStats.mActive++; // We know the thread will immediately become active
|
||||||
|
|
||||||
Thread thread = new Thread(new () => { WorkerProc(threadId); });
|
Thread thread = new Thread(new () => { WorkerProc(threadId); }, sMaxStackSize);
|
||||||
sThreads.Add(thread);
|
sThreads.Add(thread);
|
||||||
thread.Start(false);
|
thread.Start(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue