PyMutex re-entrancy not documented, confusing existing doc
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Documentation
The doc for PyMutex is very unclear if the mutex is re-entrant. Can PyMutex_Lock be called multiple times in the same thread? Do there have to be an equal number of PyMutex_Unlock calls?
The PyMutex_Lock doc says it will succeed if the thread already has the lock. PyMutex_Unlock makes no mention of it having to be called in the same thread, or if any thread is okay.
Elsewhere it says the mutex is one byte, which is not enough to do any form of counting.
The relevance is that I have C code wrapping a library and that library can make callbacks. That means there are multiple paths through the call stack. A re-entrant counting mutex would work perfectly, and it is impossible to use a non-counted lock in that scenario, short of implementing another layer of locking to do the counting.
Linked PRs
- gh-146543
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con il riferimento all’API PyMutex nella documentazione sulla sincronizzazione in C ed esamina la PR collegata gh-146543. Determina il comportamento documentato per le chiamate ripetute a PyMutex_Lock e il thread e il numero di chiamate richiesti per PyMutex_Unlock, quindi aggiorna la documentazione in modo che tali regole siano esplicite.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, python
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100