mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
PyMutex is a one byte lock with fast, inlineable lock and unlock functions for the common uncontended case. The design is based on WebKit's WTF::Lock. PyMutex is built using the _PyParkingLot APIs, which provides a cross-platform futex-like API (based on WebKit's WTF::ParkingLot). This internal API will be used for building other synchronization primitives used to implement PEP 703, such as one-time initialization and events. This also includes tests and a mini benchmark in Tools/lockbench/lockbench.py to compare with the existing PyThread_type_lock. Uncontended acquisition + release: * Linux (x86-64): PyMutex: 11 ns, PyThread_type_lock: 44 ns * macOS (arm64): PyMutex: 13 ns, PyThread_type_lock: 18 ns * Windows (x86-64): PyMutex: 13 ns, PyThread_type_lock: 38 ns PR Overview: The primary purpose of this PR is to implement PyMutex, but there are a number of support pieces (described below). * PyMutex: A 1-byte lock that doesn't require memory allocation to initialize and is generally faster than the existing PyThread_type_lock. The API is internal only for now. * _PyParking_Lot: A futex-like API based on the API of the same name in WebKit. Used to implement PyMutex. * _PyRawMutex: A word sized lock used to implement _PyParking_Lot. * PyEvent: A one time event. This was used a bunch in the "nogil" fork and is useful for testing the PyMutex implementation, so I've included it as part of the PR. * pycore_llist.h: Defines common operations on doubly-linked list. Not strictly necessary (could do the list operations manually), but they come up frequently in the "nogil" fork. ( Similar to https://man.freebsd.org/cgi/man.cgi?queue) --------- Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com> |
||
|---|---|---|
| .. | ||
| 2020-11-11-22-36-29.bpo-42327.ODSZBM.rst | ||
| 2023-05-19-10-22-34.gh-issue-104668.MLX1g9.rst | ||
| 2023-05-25-15-44-48.gh-issue-104584.cSAoRh.rst | ||
| 2023-05-29-16-09-27.gh-issue-104922.L23qaU.rst | ||
| 2023-05-30-10-15-13.gh-issue-105071.dPtp7c.rst | ||
| 2023-05-30-17-45-32.gh-issue-105115.iRho1K.rst | ||
| 2023-05-30-19-11-09.gh-issue-105107.YQwMnm.rst | ||
| 2023-05-31-16-51-18.gh-issue-105145.b3B6lJ.rst | ||
| 2023-05-31-18-37-57.gh-issue-105156.R4El5V.rst | ||
| 2023-05-31-19-38-45.gh-issue-85275.doojgE.rst | ||
| 2023-06-01-09-40-30.gh-issue-105145.WOOE-w.rst | ||
| 2023-06-01-11-23-28.gh-issue-105182.kLEHl-.rst | ||
| 2023-06-01-11-24-03.gh-issue-105182.l5sCw4.rst | ||
| 2023-06-06-10-57-18.gh-issue-105268.OTJUko.rst | ||
| 2023-06-06-14-14-41.gh-issue-103968.BTO6II.rst | ||
| 2023-06-06-17-43-28.gh-issue-105396.FQJG5B.rst | ||
| 2023-06-09-12-35-55.gh-issue-105387.wM_oL-.rst | ||
| 2023-06-09-19-16-57.gh-issue-105603.-z6G22.rst | ||
| 2023-06-09-23-34-25.gh-issue-105375.n7amiF.rst | ||
| 2023-06-13-14-24-55.gh-issue-105227.HDL9aF.rst | ||
| 2023-06-19-20-02-16.gh-issue-105922.o4T6wO.rst | ||
| 2023-06-20-08-59-05.gh-issue-105927.DfGeEA.rst | ||
| 2023-06-22-00-25-55.gh-issue-105927.GRxZtI.rst | ||
| 2023-06-23-02-57-15.gh-issue-106004.-OToh6.rst | ||
| 2023-06-25-18-01-27.gh-issue-106084.PEzqU3.rst | ||
| 2023-06-28-02-30-50.gh-issue-106168.NFOZPv.rst | ||
| 2023-06-30-09-33-25.gh-issue-106023.YvYiE4.rst | ||
| 2023-07-01-21-23-33.gh-issue-106316.hp2Ijw.rst | ||
| 2023-07-02-00-00-20.gh-issue-106320.tZWcvG.rst | ||
| 2023-07-07-19-14-00.gh-issue-106521.Veh9f3.rst | ||
| 2023-07-08-12-24-17.gh-issue-106307.FVnkBw.rst | ||
| 2023-07-11-01-07-39.gh-issue-106572.y1b35X.rst | ||
| 2023-07-22-14-40-48.gh-issue-106320.H3u7x4.rst | ||
| 2023-07-25-13-41-09.gh-issue-107226.N919zH.rst | ||
| 2023-07-25-17-23-08.gh-issue-107249.xqk2ke.rst | ||
| 2023-08-10-11-12-25.gh-issue-107810.oJ40Qx.rst | ||
| 2023-08-13-12-33-00.gh-issue-107915.jQ0wOi.rst | ||
| 2023-08-14-10-59-03.gh-issue-107916.KH4Muo.rst | ||
| 2023-08-16-17-16-19.gh-issue-108014.wXN3CF.rst | ||
| 2023-08-22-13-00-54.gh-issue-108337.wceHZm.rst | ||
| 2023-08-22-18-45-20.gh-issue-108314.nOlmwq.rst | ||
| 2023-08-24-20-08-02.gh-issue-108014.20DOSS.rst | ||
| 2023-08-30-02-54-06.gh-issue-108634.oV3Xzk.rst | ||
| 2023-09-01-16-28-09.gh-issue-108511.gg-QDG.rst | ||
| 2023-09-01-18-42-31.gh-issue-108765.IyYNDu.rst | ||
| 2023-09-01-20-41-49.gh-issue-108765.5dXc1r.rst | ||
| 2023-09-01-21-10-29.gh-issue-108765.eeXtYF.rst | ||
| 2023-09-02-22-35-55.gh-issue-108765.4TOdBT.rst | ||
| 2023-09-12-13-09-36.gh-issue-108724.-yMsC8.rst | ||
| README.rst | ||
Put news entry `blurb`_ files for the *C API* section in this directory. .. _blurb: https://pypi.org/project/blurb/