summary refs log tree commit diff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-27 12:19:25 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-27 12:19:25 +0000
commit59682e618805701f9c249736514df6db457895f9 (patch)
tree4a66762d4dffe3d37ed84c13bd0d2c314275b233 /src/libutil/util.cc
parenta24b78e9f1a7326badb6c38d5d63aeb6ccdf9970 (diff)
downloadguix-59682e618805701f9c249736514df6db457895f9.tar.gz
* Make lock removal safe by signalling to blocked processes that the
  lock they are waiting on has become stale (we do this by writing a
  meaningless token to the unlinked file).

Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index e77009321d..0af6ee149b 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -415,6 +415,15 @@ bool AutoCloseFD::isOpen()
 }
 
 
+/* Pass responsibility for closing this fd to the caller. */
+int AutoCloseFD::borrow()
+{
+    int oldFD = fd;
+    fd = -1;
+    return oldFD;
+}
+
+
 void Pipe::create()
 {
     int fds[2];