symbian-qemu-0.9.1-12/python-2.6.1/Lib/test/crashers/multithreaded_close.py
changeset 1 2fb8b9db1c86
equal deleted inserted replaced
0:ffa851df0825 1:2fb8b9db1c86
       
     1 # f.close() is not thread-safe: calling it at the same time as another
       
     2 # operation (or another close) on the same file, but done from another
       
     3 # thread, causes crashes.  The issue is more complicated than it seems,
       
     4 # witness the discussions in:
       
     5 #
       
     6 # http://bugs.python.org/issue595601
       
     7 # http://bugs.python.org/issue815646
       
     8 
       
     9 import thread
       
    10 
       
    11 while 1:
       
    12     f = open("multithreaded_close.tmp", "w")
       
    13     thread.start_new_thread(f.close, ())
       
    14     f.close()