diff options
author | Anton Lapounov <anton.lapounov@microsoft.com> | 2017-03-15 00:58:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-15 00:58:29 +0300 |
commit | 71f7b3bf0c5ac62c4bf7aa3eb6562ff2d4fd3443 (patch) | |
tree | 10955d3b1740211585a2204caa2b5038738fc53e /src/Native/Runtime/MiscHelpers.cpp | |
parent | 1673871e15e5948125effd5fea631f198f752735 (diff) |
Implement Thread for Unix (#2957)
Implement Thread for Unix:
* Use a callback from PalDetachThread to signal the thread as stopped.
* In BasicThreading test account that SafeHandle postpones disposing until the next garbage collection.
* Move reusable code from RuntimeThread.Windows.cs to RuntimeThread.cs.
* Rename *Core functions to *Internal to be close to CoreCLR implementation.
* Priority is ignored for now.
Fixes for Windows:
* Merge HasFinishedExecution and JoinInternal.
* Handle race condition between JoinInternal and SafeWaitHandle finalizer: SafeWaitHandle.DangerousAddRef may throw an ObjectDisposedException.
* Handle Interop.mincore.CreateThread returning the NULL handle.
Diffstat (limited to 'src/Native/Runtime/MiscHelpers.cpp')
-rw-r--r-- | src/Native/Runtime/MiscHelpers.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Native/Runtime/MiscHelpers.cpp b/src/Native/Runtime/MiscHelpers.cpp index da6c74f72..ecc131bbf 100644 --- a/src/Native/Runtime/MiscHelpers.cpp +++ b/src/Native/Runtime/MiscHelpers.cpp @@ -749,3 +749,15 @@ COOP_PINVOKE_HELPER(void, RhGetCurrentThreadStackBounds, (PTR_VOID * ppStackLow, { ThreadStore::GetCurrentThread()->GetStackBounds(ppStackLow, ppStackHigh); } + +#ifdef PLATFORM_UNIX + +// Function to call when a thread is detached from the runtime +ThreadExitCallback g_threadExitCallback; + +COOP_PINVOKE_HELPER(void, RhSetThreadExitCallback, (void * pCallback)) +{ + g_threadExitCallback = (ThreadExitCallback)pCallback; +} + +#endif // PLATFORM_UNIX |