|
From: Harald O. <har...@el...> - 2025-10-13 10:17:39
|
Thanks, TIP is online. We would need an implementation in the main branch. A clear warning "breaking backward compatibility of a never working feature" would also be great for formal reasons. Thanks for all, Harald Am 13.10.2025 um 11:38 schrieb Christian Werner: > On 10/13/2025 11:04 AM, Harald Oehlmann wrote: > > Harald, > >> ... >> I will sponsor with pleasure. > > fine, here we go. Please add this markdown to the TIP repo. > > -----8><-----8><----- > # TIP 734: Revert TIP 509 > Author: Christian Werner <und...@go...> > State: > Type: Project > Vote: > Created: 13-Oct-2025 > Post-History: > Keywords: Tcl,threads > Tcl-Version: 9.1 > Vote-Results: > Votes-For > Votes-Against: > Votes-Present: > Tcl-Branch: > ----- > > # Abstract > > This TIP proposes to revert TIP 509 which introduced reentrant > mutexes on all core-supported platforms. > > # Context > > The original TIP 509 was invented to improve POSIX signal handling > in multi-threaded Tcl and later overcome by TIP 511 which solved > POSIX signal handling without requiring mutex reform. > > # Rationale > > Making all Tcl_Mutexes reentrant interacts bad with Tcl_Conditions > since in order to successfully (legally) wait on a condition requires > the associated mutex to be unlocked exactly before the condition > is waited on and re-locked exactly afterwards. However, a deadlock > is most likely due when the mutex was (reentrant) locked more than > once. To overcome this situation additional code would be needed in > the Tcl_Mutex lock and unlock operations as well as in the wait on > condition operation to prevent from this potential deadlock situation. > Effectively, more logic is needed around synchronization operations, > i.e. it is not possible anymore on the theoretical ideal POSIX platform > to just wrap the native APIs for the Tcl_Mutex and Tcl_Condition > synchronization objects. > > Moreover, currently there are zero places in the Tcl core which > require Tcl_Mutexes to be reentrant, so this feature can be regarded > as superfluous anyway. > > # Specifications > > This TIP proposes to revert all TIP 509 changes and bring the Tcl_Mutex > system back to its 8.6 state. > > # Alternatives > > Should there be real demand in having reentrant mutexes in Tcl > a better alternative would introduce a new type, e.g. Tcl_ReentrantMutex, > which provides this feature and simultaneously prevents from the > above mentioned potential deadlocks since it cannot be used for > conditions. > > # Copyright > > This document has been placed in the public domain. > -----8><-----8><----- > > Thank you, > Christian |