mirror of
https://github.com/NixOS/nix
synced 2025-07-01 16:41:47 +02:00
Use BSD instead of POSIX file locks
POSIX file locks are essentially incompatible with multithreading. BSD locks have much saner semantics. We need this now that there can be multiple concurrent LocalStore::buildPaths() invocations.
This commit is contained in:
parent
ec415d7166
commit
e349f2c0a3
5 changed files with 45 additions and 107 deletions
|
@ -29,7 +29,7 @@ static string gcRootsDir = "gcroots";
|
|||
read. To be precise: when they try to create a new temporary root
|
||||
file, they will block until the garbage collector has finished /
|
||||
yielded the GC lock. */
|
||||
int LocalStore::openGCLock(LockType lockType)
|
||||
AutoCloseFD LocalStore::openGCLock(LockType lockType)
|
||||
{
|
||||
Path fnGCLock = (format("%1%/%2%")
|
||||
% stateDir % gcLockName).str();
|
||||
|
@ -49,7 +49,7 @@ int LocalStore::openGCLock(LockType lockType)
|
|||
process that can open the file for reading can DoS the
|
||||
collector. */
|
||||
|
||||
return fdGCLock.release();
|
||||
return fdGCLock;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue