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

Change JoinOnDelete method

This commit is contained in:
Brian Fiete 2024-03-02 17:09:10 -05:00
parent f61cb91255
commit 897b1f6fc4

View file

@ -20,6 +20,7 @@ namespace System.Threading
private Object mThreadStartArg; private Object mThreadStartArg;
bool mAutoDelete; bool mAutoDelete;
bool mJoinOnDelete;
static Monitor sMonitor = new .() ~ delete _; static Monitor sMonitor = new .() ~ delete _;
static Event<delegate void()> sOnExit ~ _.Dispose(); static Event<delegate void()> sOnExit ~ _.Dispose();
@ -393,6 +394,9 @@ namespace System.Threading
sOnExit(); sOnExit();
} }
if (mJoinOnDelete)
Join();
// Make sure we're not deleting manually if mAutoDelete is set // Make sure we're not deleting manually if mAutoDelete is set
Debug.Assert((!mAutoDelete) || (CurrentThread == this)); Debug.Assert((!mAutoDelete) || (CurrentThread == this));
// Delegate to the unmanaged portion. // Delegate to the unmanaged portion.
@ -413,8 +417,11 @@ namespace System.Threading
private extern bool IsBackgroundNative(); private extern bool IsBackgroundNative();
[CallingConvention(.Cdecl)] [CallingConvention(.Cdecl)]
private extern void SetBackgroundNative(bool isBackground); private extern void SetBackgroundNative(bool isBackground);
[CallingConvention(.Cdecl)]
public extern void SetJoinOnDelete(bool joinOnDelete); public void SetJoinOnDelete(bool joinOnDelete)
{
mJoinOnDelete = joinOnDelete;
}
public ThreadState ThreadState public ThreadState ThreadState
{ {