Skip to content

Commit 958e71a

Browse files
committed
Require closing admission to wait for threads to detach or ownership of the GIL
1 parent f68178d commit 958e71a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎RUST_API.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ its own leases:
185185
- A state with a nonzero lease count is protected from deletion. After fork,
186186
vanished states' counts disappear with them.
187187

188+
Lease acquisition requires attachment to the target interpreter throughout
189+
the admission check and counter increment. No safepoint, detachment, or
190+
reentrant call may occur between them. Closing admission requires a
191+
completed stop-the-world handshake, or ownership of that interpreter's GIL,
192+
held continuously through the final recheck and closure. The synchronization
193+
must make preceding lease increments visible to the finalizer and admission
194+
closure visible to subsequent entrants. Merely requesting a stop is
195+
insufficient.
196+
188197
PEP 788 C guards keep their shared counter, because a guard can be created
189198
without an attached thread state and closed on another thread.
190199

0 commit comments

Comments
 (0)