summaryrefslogtreecommitdiff
path: root/libthreads
diff options
context:
space:
mode:
Diffstat (limited to 'libthreads')
-rw-r--r--libthreads/rwlock.c2
-rw-r--r--libthreads/rwlock.h23
2 files changed, 21 insertions, 4 deletions
diff --git a/libthreads/rwlock.c b/libthreads/rwlock.c
index 93533a97..ae6a7c48 100644
--- a/libthreads/rwlock.c
+++ b/libthreads/rwlock.c
@@ -1,2 +1,2 @@
-#define RWLOCK_EI
+#define RWLOCK_DEFINE_EI
#include "rwlock.h"
diff --git a/libthreads/rwlock.h b/libthreads/rwlock.h
index 1a61eeea..44d9a35d 100644
--- a/libthreads/rwlock.h
+++ b/libthreads/rwlock.h
@@ -21,6 +21,13 @@
#include <cthreads.h>
#include <assert.h>
+#include <features.h>
+
+#ifdef RWLOCK_DEFINE_EI
+#define RWLOCK_EI
+#else
+#define RWLOCK_EI __extern_inline
+#endif
struct rwlock
{
@@ -31,9 +38,17 @@ struct rwlock
int readers_waiting;
};
-#ifndef RWLOCK_EI
-#define RWLOCK_EI extern inline
-#endif
+extern void rwlock_reader_lock (struct rwlock *lock);
+
+extern void rwlock_writer_lock (struct rwlock *lock);
+
+extern void rwlock_reader_unlock (struct rwlock *lock);
+
+extern void rwlock_writer_unlock (struct rwlock *lock);
+
+extern void rwlock_init (struct rwlock *lock);
+
+#if defined(__USE_EXTERN_INLINES) || defined(RWLOCK_DEFINE_EI)
/* Get a reader lock on reader-writer lock LOCK for disknode DN */
RWLOCK_EI void
@@ -104,6 +119,8 @@ rwlock_init (struct rwlock *lock)
lock->writers_waiting = 0;
}
+#endif /* Use extern inlines. */
+
#define RWLOCK_INITIALIZER \
{ MUTEX_INITIALIZER, CONDITION_INITIALIZER, 0, 0, 0 }