summaryrefslogtreecommitdiff
path: root/tests/rwlock1.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rwlock1.c')
-rw-r--r--tests/rwlock1.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/rwlock1.c b/tests/rwlock1.c
new file mode 100644
index 0000000..540ef7a
--- /dev/null
+++ b/tests/rwlock1.c
@@ -0,0 +1,31 @@
+/*
+ * rwlock1.c
+ *
+ * Create a simple rwlock object, lock it, and then unlock it again.
+ *
+ * Depends on API functions:
+ * pthread_rwlock_init()
+ * pthread_rwlock_lock()
+ * pthread_rwlock_unlock()
+ * pthread_rwlock_destroy()
+ */
+
+#include "test.h"
+
+pthread_rwlock_t rwlock = NULL;
+
+int
+main()
+{
+ assert(rwlock == NULL);
+
+ assert(pthread_rwlock_init(&rwlock, NULL) == 0);
+
+ assert(rwlock != NULL);
+
+ assert(pthread_rwlock_destroy(&rwlock) == 0);
+
+ assert(rwlock == NULL);
+
+ return 0;
+}