Fredrik Lundh wrote: > 5) check the number of links to each file > > n = os.stat(tempfile)[3] > m = os.stat(lockfile)[3] aw, forget that. I shouldn't trust google over my own code. here's the correct algorithm: f = open(tempfile, "w") f.close() n = os.stat(tempfile)[3] os.link(tempfile, lockfile) m = os.stat(tempfile)[3] if n == m+1: success! where n==1 and m==2. the os.link call can be placed in a try/except clause (if it fails, m won't be 2), or you can use a try/except around the entire thing. </F>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4