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
6dce7d63
Commit
6dce7d63
authored
Feb 02, 2012
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
parents
fe6f9d0e
e0e88b04
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
Lib/test/test_threading.py
Lib/test/test_threading.py
+23
-0
Modules/signalmodule.c
Modules/signalmodule.c
+3
-1
No files found.
Lib/test/test_threading.py
View file @
6dce7d63
...
@@ -635,6 +635,29 @@ class ThreadJoinOnShutdown(BaseTestCase):
...
@@ -635,6 +635,29 @@ class ThreadJoinOnShutdown(BaseTestCase):
output
=
"end of worker thread
\
n
end of main thread
\
n
"
output
=
"end of worker thread
\
n
end of main thread
\
n
"
self
.
assertScriptHasOutput
(
script
,
output
)
self
.
assertScriptHasOutput
(
script
,
output
)
@
unittest
.
skipUnless
(
hasattr
(
os
,
'fork'
),
"needs os.fork()"
)
def
test_reinit_tls_after_fork
(
self
):
# Issue #13817: fork() would deadlock in a multithreaded program with
# the ad-hoc TLS implementation.
def
do_fork_and_wait
():
# just fork a child process and wait it
pid
=
os
.
fork
()
if
pid
>
0
:
os
.
waitpid
(
pid
,
0
)
else
:
os
.
_exit
(
0
)
# start a bunch of threads that will fork() child processes
threads
=
[]
for
i
in
range
(
16
):
t
=
threading
.
Thread
(
target
=
do_fork_and_wait
)
threads
.
append
(
t
)
t
.
start
()
for
t
in
threads
:
t
.
join
()
class
ThreadingExceptionTests
(
BaseTestCase
):
class
ThreadingExceptionTests
(
BaseTestCase
):
# A RuntimeError should be raised if Thread.start() is called
# A RuntimeError should be raised if Thread.start() is called
...
...
Modules/signalmodule.c
View file @
6dce7d63
...
@@ -976,10 +976,12 @@ void
...
@@ -976,10 +976,12 @@ void
PyOS_AfterFork
(
void
)
PyOS_AfterFork
(
void
)
{
{
#ifdef WITH_THREAD
#ifdef WITH_THREAD
/* PyThread_ReInitTLS() must be called early, to make sure that the TLS API
* can be called safely. */
PyThread_ReInitTLS
();
PyEval_ReInitThreads
();
PyEval_ReInitThreads
();
main_thread
=
PyThread_get_thread_ident
();
main_thread
=
PyThread_get_thread_ident
();
main_pid
=
getpid
();
main_pid
=
getpid
();
_PyImport_ReInitLock
();
_PyImport_ReInitLock
();
PyThread_ReInitTLS
();
#endif
#endif
}
}
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