X
xucs007
I ran following 2 programs (lock1, lock2) at almost same time,
to write either "123456", or "222" to file "aaa" at the same time.
But I often just got "222456" in "aaa" .
Is this a bug of python fcntl module ? See 2 programs I ran:
#!/usr/bin/env python
import fcntl, time
file = open('aaa', "w")
fcntl.flock(file, fcntl.LOCK_EX)
file.write('123456')
time.sleep(10)
file.close()
#!/usr/bin/env python
import fcntl, time
file = open('aaa', "w")
fcntl.flock(file, fcntl.LOCK_EX)
file.write('222')
time.sleep(10)
file.close()
to write either "123456", or "222" to file "aaa" at the same time.
But I often just got "222456" in "aaa" .
Is this a bug of python fcntl module ? See 2 programs I ran:
#!/usr/bin/env python
import fcntl, time
file = open('aaa', "w")
fcntl.flock(file, fcntl.LOCK_EX)
file.write('123456')
time.sleep(10)
file.close()
#!/usr/bin/env python
import fcntl, time
file = open('aaa', "w")
fcntl.flock(file, fcntl.LOCK_EX)
file.write('222')
time.sleep(10)
file.close()