Skip to content

Conversation

@jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Jul 17, 2025

Use the shared managed wait subsystem for CoreCLR's managed code instead of the Win32 PAL

Also, remove the named mutex support from the CoreCLR PAL as nothing uses it now.

TODO: Once #117688 is in, we can remove Mutex support from the Win32 PAL entirely

Unblocks #115685

Depends on #117635

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@jkoritzinsky jkoritzinsky added this to the 11.0.0 milestone Jul 17, 2025
@jkoritzinsky jkoritzinsky added the blocked Issue/PR is blocked on something - see comments label Jul 17, 2025
@jkoritzinsky jkoritzinsky force-pushed the coreclr-managed-wait branch from 25446d0 to 63dc9af Compare July 21, 2025 19:44
@jkoritzinsky jkoritzinsky force-pushed the coreclr-managed-wait branch 3 times, most recently from 06de3b2 to 63a1aa6 Compare July 31, 2025 16:44
@jkoritzinsky jkoritzinsky removed the blocked Issue/PR is blocked on something - see comments label Oct 30, 2025
Comment on lines -107 to -108
#cmakedefine01 HAVE_FULLY_FEATURED_PTHREAD_MUTEXES
#cmakedefine01 HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be removed from:

eng/native/tryrun.cmake:    set_cache_value(HAVE_FULLY_FEATURED_PTHREAD_MUTEXES 1)
eng/native/tryrun.cmake:    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 1)
eng/native/tryrun.cmake:    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
eng/native/tryrun.cmake:    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
eng/native/tryrun.cmake:    set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
eng/native/tryrun.cmake:  set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
eng/native/tryrun_ios_tvos.cmake:set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 1)


extern "C" BOOL QCALLTYPE ThreadNative_Join(QCall::ObjectHandleOnStack thread, INT32 Timeout)
#if TARGET_WINDOWS
extern "C" HANDLE QCALLTYPE ThreadNative_GetOSHandle(QCall::ThreadHandle t);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
extern "C" HANDLE QCALLTYPE ThreadNative_GetOSHandle(QCall::ThreadHandle t);
extern "C" HANDLE QCALLTYPE ThreadNative_GetOSHandle(QCall::ThreadHandle t)

void
ThreadCleanupThread::EnsureCleanupThreadExists()
{
if (ForeignThreadsToCleanUpEvent == nullptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can use contract. Can it throw?

pEvent.SuppressRelease();
Thread* pCleanupThread = SetupUnstartedThread();

if (pCleanupThread->CreateNewThread(0, &ForeignThreadCleanupThreadStart, NULL, W(".NET External Thread Cleanup Thread")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to retry if any of this fails?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Threading runtime-coreclr specific to the CoreCLR runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants