1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 13:24:09 +02:00

Fixes from valgrind

This commit is contained in:
Brian Fiete 2022-03-18 18:06:14 -07:00
parent 0feaaded22
commit 676e7988fb
31 changed files with 243 additions and 147 deletions

View file

@ -73,14 +73,22 @@ namespace System.Threading
int32 stackStart = 0;
thread.SetStackStart((void*)&stackStart);
if (thread.mDelegate is ThreadStart)
var dlg = thread.mDelegate;
var threadStartArg = thread.mThreadStartArg;
thread.mDelegate = null;
thread.ThreadStarted();
if (dlg is ThreadStart)
{
((ThreadStart)thread.mDelegate)();
((ThreadStart)dlg)();
}
else
{
((ParameterizedThreadStart)thread.mDelegate)(thread.mThreadStartArg);
((ParameterizedThreadStart)dlg)(threadStartArg);
}
delete dlg;
}
public static this()
@ -173,6 +181,7 @@ namespace System.Threading
extern void ManualThreadInit();
extern void StartInternal();
extern void SetStackStart(void* ptr);
extern void ThreadStarted();
public void Start(bool autoDelete = true)
{
@ -335,10 +344,9 @@ namespace System.Threading
mMaxStackSize = maxStackSize;
}
public ~this()
{
// Make sure we're not deleting manually it mAutoDelete is set
// Make sure we're not deleting manually if mAutoDelete is set
Debug.Assert((!mAutoDelete) || (CurrentThread == this));
// Delegate to the unmanaged portion.
InternalFinalize();