Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue30808

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Use _Py_atomic API for concurrency-sensitive signal state
Type:enhancementStage:resolved
Components:Interpreter CoreVersions:Python 3.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: jyasskin, neologix, pitrou, vstinner
Priority:normalKeywords:

Created on2017-06-29 20:01 bypitrou, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 2417mergedpitrou,2017-06-29 20:01
PR 3007mergedpitrou,2017-08-06 15:10
Messages (5)
msg297304 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-06-29 20:01
We already use the _Py_atomic APIs in ceval.c, for lockless boolean flags.  We should do the same in the signal module where there are similar concurrency issues (for example between the signal handler running in one thread and PyErr_CheckSignals running in another thread).
msg297313 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2017-06-29 20:22
There is a sig_atomic_t type. Should we use that one?https://www.gnu.org/software/libc/manual/html_node/Atomic-Types.html"To avoid uncertainty about interrupting access to a variable, you can use a particular data type for which access is always atomic: sig_atomic_t. Reading and writing this data type is guaranteed to happen in a single instruction, so there’s no way for a handler to run “in the middle” of an access."
msg297315 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-06-29 20:25
Look at the PR :-) That's what we used.  But, while sig_atomic_t guarantees that accesses are atomic, it doesn't enforce a memory order.  So the CPU (depending on the architecture) is free to reorder writes.
msg298478 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-07-17 10:25
New changeset2c8a5e4c968217f9672340e520942c4ed788d8de by Antoine Pitrou in branch 'master':bpo-30808: Use _Py_atomic API for concurrency-sensitive signal state (#2417)https://github.com/python/cpython/commit/2c8a5e4c968217f9672340e520942c4ed788d8de
msg299806 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2017-08-06 17:32
New changeset57e836cb41656ac23042886db6b5985c036a7ce2 by Antoine Pitrou in branch '3.6':[3.6]bpo-30808: Use _Py_atomic API for concurrency-sensitive signal state (GH-2417) (#3007)https://github.com/python/cpython/commit/57e836cb41656ac23042886db6b5985c036a7ce2
History
DateUserActionArgs
2022-04-11 14:58:48adminsetgithub: 74991
2017-08-06 17:32:41pitrousetmessages: +msg299806
2017-08-06 15:10:26pitrousetpull_requests: +pull_request3041
2017-07-17 10:25:40pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-07-17 10:25:21pitrousetmessages: +msg298478
2017-06-29 20:25:23pitrousetmessages: +msg297315
2017-06-29 20:22:45vstinnersetmessages: +msg297313
2017-06-29 20:01:26pitrousetpull_requests: +pull_request2553
2017-06-29 20:01:06pitroucreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp