summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-02-11 18:55:36 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-02-11 18:55:36 +0000
commit3139e2fd3f00225ac02821ea8895758740af4556 (patch)
treebe2caaa8d9831f7730a8fd7a6f9a46c65a95debe
parente8121a05d1543c756918ea9531488c7480d723b7 (diff)
entered into RCS
-rw-r--r--libfshelp/lock-acquire.c10
-rw-r--r--libfshelp/lock-init.c2
-rw-r--r--libfshelp/locks.h4
3 files changed, 10 insertions, 6 deletions
diff --git a/libfshelp/lock-acquire.c b/libfshelp/lock-acquire.c
index 0c1bb788..f8ddb7a6 100644
--- a/libfshelp/lock-acquire.c
+++ b/libfshelp/lock-acquire.c
@@ -19,7 +19,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
-#include "fshelp.h"
+#include "locks.h"
error_t
fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut,
@@ -46,12 +46,12 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut,
if (*user == LOCK_SH)
{
if (!--box->shcount)
- box->lock_type == LOCK_UN;
+ box->type = LOCK_UN;
}
else if (*user == LOCK_EX)
- box->lock_type == LOCK_UN;
+ box->type = LOCK_UN;
- if (box->lock_type == LOCK_UN && box->waiting)
+ if (box->type == LOCK_UN && box->waiting)
{
box->waiting = 0;
condition_broadcast (&box->wait);
@@ -73,7 +73,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut,
}
/* If there is an exclusive lock, wait for it to end. */
- while (lock->type == LOCK_EX)
+ while (box->type == LOCK_EX)
{
if (flags & LOCK_NB)
return EWOULDBLOCK;
diff --git a/libfshelp/lock-init.c b/libfshelp/lock-init.c
index f32dfae8..4b1da97e 100644
--- a/libfshelp/lock-init.c
+++ b/libfshelp/lock-init.c
@@ -19,6 +19,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Written by Michael I. Bushnell. */
+#include "locks.h"
+
/* Initialize a lock box. */
void
fshelp_lock_init (struct lock_box *box)
diff --git a/libfshelp/locks.h b/libfshelp/locks.h
index b2dc1a53..dcecf5d9 100644
--- a/libfshelp/locks.h
+++ b/libfshelp/locks.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994 Free Software Foundation
+ Copyright (C) 1994 Free Software Foundation
This file is part of the GNU Hurd.
@@ -24,3 +24,5 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <cthreads.h>
#include <hurd/ports.h>
#include "fshelp.h"
+#include <sys/file.h>
+#include <assert.h>