Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
d237b3f0
Kaydet (Commit)
d237b3f0
authored
5 years ago
tarafından
Jeroen Demeyer
Kaydeden (comit)
Miss Islington (bot)
5 years ago
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-36601: clarify signal handler comment and remove unnecessary pid check. (GH-12784)
https://bugs.python.org/issue36601
üst
d267ac20
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
2019-04-13-16-14-16.bpo-36601.mIgS7t.rst
...ore and Builtins/2019-04-13-16-14-16.bpo-36601.mIgS7t.rst
+2
-0
signalmodule.c
Modules/signalmodule.c
+10
-15
No files found.
Misc/NEWS.d/next/Core and Builtins/2019-04-13-16-14-16.bpo-36601.mIgS7t.rst
0 → 100644
Dosyayı görüntüle @
d237b3f0
A long-since-meaningless check for ``getpid() == main_pid`` was removed
from Python's internal C signal handler.
This diff is collapsed.
Click to expand it.
Modules/signalmodule.c
Dosyayı görüntüle @
d237b3f0
...
...
@@ -73,11 +73,12 @@ class sigset_t_converter(CConverter):
/*
NOTES ON THE INTERACTION BETWEEN SIGNALS AND THREADS
W
hen threads are supported, w
e want the following semantics:
We want the following semantics:
- only the main thread can set a signal handler
- only the main thread runs the signal handler
- signals can be delivered to any thread
- any thread can get a signal handler
- signals are only delivered to the main thread
I.e. we don't support "synchronous signals" like SIGFPE (catching
this doesn't make much sense in Python anyway) nor do we support
...
...
@@ -88,17 +89,17 @@ class sigset_t_converter(CConverter):
We still have the problem that in some implementations signals
generated by the keyboard (e.g. SIGINT) are delivered to all
threads (e.g. SGI), while in others (e.g. Solaris) such signals are
delivered to one random thread (an intermediate possibility would
be to deliver it to the main thread -- POSIX?). For now, we have
a working implementation that works in all three cases -- the
handler ignores signals if getpid() isn't the same as in the main
thread. XXX This is a hack.
delivered to one random thread. On Linux, signals are delivered to
the main thread (unless the main thread is blocking the signal, for
example because it's already handling the same signal). Since we
allow signals to be delivered to any thread, this works fine. The
only oddity is that the thread executing the Python signal handler
may not be the thread that received the signal.
*/
#include <sys/types.h>
/* For pid_t */
#include "pythread.h"
static
unsigned
long
main_thread
;
static
pid_t
main_pid
;
static
PyInterpreterState
*
main_interp
;
static
volatile
struct
{
...
...
@@ -326,11 +327,7 @@ signal_handler(int sig_num)
{
int
save_errno
=
errno
;
/* See NOTES section above */
if
(
getpid
()
==
main_pid
)
{
trip_signal
(
sig_num
);
}
trip_signal
(
sig_num
);
#ifndef HAVE_SIGACTION
#ifdef SIGCHLD
...
...
@@ -1328,7 +1325,6 @@ PyInit__signal(void)
int
i
;
main_thread
=
PyThread_get_thread_ident
();
main_pid
=
getpid
();
main_interp
=
_PyInterpreterState_Get
();
/* Create the module and add the functions */
...
...
@@ -1739,7 +1735,6 @@ _PySignal_AfterFork(void)
* the interpreter had an opportunity to call the handlers. issue9535. */
_clear_pending_signals
();
main_thread
=
PyThread_get_thread_ident
();
main_pid
=
getpid
();
main_interp
=
_PyInterpreterState_Get
();
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment