Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
10c30d67
Commit
10c30d67
authored
Jun 10, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8407: signal.sigwait() releases the GIL
Initial patch by Charles-François Natali.
parent
589f89e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
Lib/test/test_signal.py
Lib/test/test_signal.py
+19
-0
Modules/signalmodule.c
Modules/signalmodule.c
+2
-0
No files found.
Lib/test/test_signal.py
View file @
10c30d67
...
@@ -607,6 +607,25 @@ class PendingSignalsTests(unittest.TestCase):
...
@@ -607,6 +607,25 @@ class PendingSignalsTests(unittest.TestCase):
signal
.
alarm
(
1
)
signal
.
alarm
(
1
)
self
.
assertEqual
(
signal
.
sigwait
([
signal
.
SIGALRM
]),
signal
.
SIGALRM
)
self
.
assertEqual
(
signal
.
sigwait
([
signal
.
SIGALRM
]),
signal
.
SIGALRM
)
@
unittest
.
skipUnless
(
hasattr
(
signal
,
'sigwait'
),
'need signal.sigwait()'
)
@
unittest
.
skipIf
(
threading
is
None
,
"test needs threading module"
)
def
test_sigwait_thread
(
self
):
signum
=
signal
.
SIGUSR1
old_handler
=
signal
.
signal
(
signum
,
self
.
handler
)
self
.
addCleanup
(
signal
.
signal
,
signum
,
old_handler
)
def
kill_later
():
time
.
sleep
(
1
)
os
.
kill
(
os
.
getpid
(),
signum
)
killer
=
threading
.
Thread
(
target
=
kill_later
)
killer
.
start
()
try
:
self
.
assertEqual
(
signal
.
sigwait
([
signum
]),
signum
)
finally
:
killer
.
join
()
@
unittest
.
skipUnless
(
hasattr
(
signal
,
'pthread_sigmask'
),
@
unittest
.
skipUnless
(
hasattr
(
signal
,
'pthread_sigmask'
),
'need signal.pthread_sigmask()'
)
'need signal.pthread_sigmask()'
)
def
test_pthread_sigmask_arguments
(
self
):
def
test_pthread_sigmask_arguments
(
self
):
...
...
Modules/signalmodule.c
View file @
10c30d67
...
@@ -662,7 +662,9 @@ signal_sigwait(PyObject *self, PyObject *args)
...
@@ -662,7 +662,9 @@ signal_sigwait(PyObject *self, PyObject *args)
if
(
iterable_to_sigset
(
signals
,
&
set
))
if
(
iterable_to_sigset
(
signals
,
&
set
))
return
NULL
;
return
NULL
;
Py_BEGIN_ALLOW_THREADS
err
=
sigwait
(
&
set
,
&
signum
);
err
=
sigwait
(
&
set
,
&
signum
);
Py_END_ALLOW_THREADS
if
(
err
)
{
if
(
err
)
{
errno
=
err
;
errno
=
err
;
return
PyErr_SetFromErrno
(
PyExc_OSError
);
return
PyErr_SetFromErrno
(
PyExc_OSError
);
...
...
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