aboutsummaryrefslogtreecommitdiff
#pragma once

#include "types.hh"


namespace nix {


/* Open (possibly create) a lock file and return the file descriptor.
   -1 is returned if create is false and the lock could not be opened
   because it doesn't exist.  Any other error throws an exception. */
int openLockFile(const Path & path, bool create);

/* Delete an open lock file. */
void deleteLockFile(const Path & path, int fd);

enum LockType { ltRead, ltWrite, ltNone };

bool lockFile(int fd, LockType lockType, bool wait);


class PathLocks 
{
private:
    typedef std::pair<int, Path> FDPair;
    list<FDPair> fds;
    bool deletePaths;

public:
    PathLocks();
    PathLocks(const PathSet & paths,
        const string & waitMsg = "");
    bool lockPaths(const PathSet & _paths,
        const string & waitMsg = "",
        bool wait = true);
    ~PathLocks();
    void unlock();
    void setDeletion(bool deletePaths);
};


bool pathIsLockedByMe(const Path & path);


}
ion value='40'>40space:mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-14 16:12:09 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-14 16:41:00 +0200
commite9962d8a6b7a7d41604004e4a84d05201654b91b (patch)
tree90145dcff8af05785aaae52c252596d9579b8e4c /gnu/packages/java-compression.scm
parent5c819cd21475ecbe7a1f4cd7fe7df9045e44debb (diff)
downloadguix-e9962d8a6b7a7d41604004e4a84d05201654b91b.tar.gz
guix-e9962d8a6b7a7d41604004e4a84d05201654b91b.zip
gnu: r-isoband: Update to 0.2.1.
* gnu/packages/cran.scm (r-isoband): Update to 0.2.1. [native-inputs]: Add r-knitr.
Diffstat (limited to 'gnu/packages/java-compression.scm')
0 files changed, 0 insertions, 0 deletions