aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-11-10 20:40:01 +0000
committerNick Mathewson <nickm@torproject.org>2008-11-10 20:40:01 +0000
commit6c50ab6e61f952714cfee5de76e471036cb924d7 (patch)
tree77616b8ded7139b9724d8872e3c26d4a76e22e43 /src/common
parent90e832a5dbb5297e7a77c5e2c0a0c047a160eb0f (diff)
downloadtor-6c50ab6e61f952714cfee5de76e471036cb924d7.tar
tor-6c50ab6e61f952714cfee5de76e471036cb924d7.tar.gz
Document a couple of functions.
svn:r17239
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 11455356e..b3d436196 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -476,12 +476,22 @@ touch_file(const char *fname)
return 0;
}
+/** Represents a lockfile on which we hold the lock. */
struct tor_lockfile_t {
char *filename;
int fd;
};
-/** DOCDOC. What's this function do? */
+/** Try to get a lock on the lockfile <b>filename</b>, creating it as
+ * necessary. If someone else has the lock and <b>blocking</b> is true,
+ * wait until the lock is available. Otherwise return immediately whether
+ * we succeeded or not.
+ *
+ * Set *<b>locked_out</b> to true if somebody else had the lock, and to false
+ * otherwise.
+ *
+ * Return a <b>tor_lockfile_t</b> on success, NULL on failure.
+ */
tor_lockfile_t *
tor_lockfile_lock(const char *filename, int blocking, int *locked_out)
{
@@ -523,6 +533,7 @@ tor_lockfile_lock(const char *filename, int blocking, int *locked_out)
return result;
}
+/** Release the lock held as <b>lockfile</b>. */
void
tor_lockfile_unlock(tor_lockfile_t *lockfile)
{