3 ms·
There is a catch, though; if you have the same file open multiple times, even with different names, then closing one file descriptor will release all locks on t
by carey 17y ago
There is a catch, though; if you have the same file open multiple times, even with different names, then closing one file descriptor will release all locks on that file in the same process, even in different threads.
SQLite goes to great lengths to work around this. See: http://www.google.com/search?q=broken+by+design+site:sqlite.org http://www.google.com/search?q=broken+by+design+site:sqlite....
- cperciva 17y agoThere is a catch, though; if you have the same file open multiple times, even with different names, then closing one file descriptor will release all locks on that file in the same process, even in different threads. It's even worse than that. A lock is released as soon as any of its owning processes closes any descriptor to that file. As a result, if a child forks and exits, the parent no longer holds any locks...
- JeffJenkins 17y agoThat's definitely worth keeping in mind! Does that apply to sibling processes as well (like two apache child processes)?