Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e9072ad4757f0b943b98e35ee6fac78935e62d0b
      
https://github.com/WebKit/WebKit/commit/e9072ad4757f0b943b98e35ee6fac78935e62d0b
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-04-30 (Thu, 30 Apr 2026)

  Changed paths:
    M Source/WTF/wtf/Threading.cpp
    M Source/bmalloc/CMakeLists.txt
    M Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
    M Source/bmalloc/libpas/libpas.xcodeproj/project.pbxproj
    A Source/bmalloc/libpas/src/libpas/pas_process.c
    A Source/bmalloc/libpas/src/libpas/pas_process.h
    M Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c

  Log Message:
  -----------
  [libpas] Clean up Windows shutdown handling
https://bugs.webkit.org/show_bug.cgi?id=313684
rdar://175884563

Reviewed by Keith Miller.

Windows has a bit wierd behavior compared to the other platforms. When
the thread starting the process finishes (Windows does not have *main
thread*, but this is kind-of equivalent thing to the other platforms'
main thread), typically ExitProcess is called. But the behavior of
ExitProcess is awkward: it terminates the other threads, but it attempts
to clean up the current calling thread in an usual manner. This means
that calling thread does TLS cleanup while the other threads are
terminated abruptly. As a result, it is possible that the other threads
die while they are holding a lock. If normal TLS cleanup takes a lock,
there is a chance that this lock gets never released.

This patch adds pas_process_is_shutting_down function, which returns
true when the process is in the middle of "shutting down" state. Other
than Windows, it always returns false. But on Windows, it can return
true. Then we use this flag to decide whether we should do TLS cleanup.

* Source/WTF/wtf/Threading.cpp:
(WTF::Thread::didExit):
(WTF::shouldRemoveThreadFromThreadGroup): Deleted.
* Source/bmalloc/CMakeLists.txt:
* Source/bmalloc/bmalloc.xcodeproj/project.pbxproj:
* Source/bmalloc/libpas/libpas.xcodeproj/project.pbxproj:
* Source/bmalloc/libpas/src/libpas/pas_process.c: Added.
(pas_process_is_shutting_down):
* Source/bmalloc/libpas/src/libpas/pas_process.h: Added.
* Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c:
(destructor):

Canonical link: https://commits.webkit.org/312389@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to