Add a crasher for the long-standing issue with closing a file

while another thread uses it.
This commit is contained in:
Armin Rigo 2007-10-21 09:14:15 +00:00
parent 27a4498fca
commit 1486182451
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
# f.close() is not thread-safe: calling it at the same time as another
# operation (or another close) on the same file, but done from another
# thread, causes crashes. The issue is more complicated than it seems,
# witness the discussions in:
#
# http://bugs.python.org/issue595601
# http://bugs.python.org/issue815646
import thread
while 1:
f = open("multithreaded_close.tmp", "w")
thread.start_new_thread(f.close, ())
f.close()