Skip to content

Commit

Permalink
[Windows] Remove obsolete TLS finalization
Browse files Browse the repository at this point in the history
Foundation uses Fls now. Fls provides automatic cleanup, and
manual finalization on DLL_THREAD_DETACH is not needed.
  • Loading branch information
lxbndr committed Oct 24, 2020
1 parent 9ebb444 commit 07f9c61
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
10 changes: 0 additions & 10 deletions CoreFoundation/Base.subproj/CFPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,16 +663,6 @@ CF_PRIVATE void __CFTSDWindowsCleanup() {
FlsFree(__CFTSDIndexKey);
}

// Called for each thread as it exits, on Windows only
CF_PRIVATE void __CFFinalizeWindowsThreadData() {
// Normally, this should call the finalizer several times to emulate the behavior of pthreads on Windows. However, a few bugs keep us from doing this:
// <rdar://problem/8989063> REGRESSION(CF-610-CF-611): Crash closing Safari in BonjourDB destructor (Windows)
// <rdar://problem/9326814> SyncUIHandler crashes after conflict is resolved and we do SyncNow
// and a bug in dispatch keeps us from using pthreadsWin32 directly, because it does not deal with the case of a dispatch_async happening during process exit (it attempts to create a thread, but that is illegal on Win32 and causes a hang).
// So instead we just finalize once, which is the behavior pre-Airwolf anyway
__CFTSDFinalize(TlsGetValue(__CFTSDIndexKey));
}

#else

static _CFThreadSpecificKey __CFTSDIndexKey;
Expand Down
3 changes: 0 additions & 3 deletions CoreFoundation/Base.subproj/CFRuntime.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,6 @@ CF_PRIVATE void __CFTSDInitialize(void);
#if TARGET_OS_WIN32
// From CFPlatform.c
CF_PRIVATE void __CFTSDWindowsCleanup(void);
CF_PRIVATE void __CFFinalizeWindowsThreadData(void);
#endif

#if TARGET_OS_MAC
Expand Down Expand Up @@ -1352,8 +1351,6 @@ int DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID pReserved ) {
// do these last
if (cfBundle) CFRelease(cfBundle);
__CFStringCleanup();
} else if (dwReason == DLL_THREAD_DETACH) {
__CFFinalizeWindowsThreadData();
}
return TRUE;
}
Expand Down

0 comments on commit 07f9c61

Please sign in to comment.