## Copyright (C) 1995-2010 Index Data
check_PROGRAMS = test_xmalloc test_iconv test_nmem test_matchstr test_wrbuf \
- test_odr test_ccl test_log \
+ test_odr test_ccl test_log test_mutex \
test_soap1 test_soap2 test_odrstack test_log_thread test_xmlquery test_pquery \
test_comstack test_filepath test_record_conv test_retrieval test_tpath \
test_timing test_query_charset test_oid test_icu test_match_glob \
cd $(srcdir); $(YAZCOMP) tstodr.asn
LDADD = ../src/libyaz.la
-test_icu_LDADD = ../src/libyaz_icu.la $(ICU_LIBS)
+test_icu_LDADD = ../src/libyaz_icu.la ../src/libyaz.la $(ICU_LIBS)
+test_mutex_LDADD = ../src/libyaz_server.la ../src/libyaz.la $(PTHREAD_LIBS)
AM_CFLAGS = $(PTHREAD_CFLAGS)
test_odrstack_SOURCES = test_odrstack.c
test_ccl_SOURCES = test_ccl.c
test_log_SOURCES = test_log.c
+test_mutex_SOURCES = test_mutex.c
test_soap1_SOURCES = test_soap1.c
test_soap2_SOURCES = test_soap2.c
test_log_thread_SOURCES = test_log_thread.c
--- /dev/null
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data
+ * See the file LICENSE for details.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <yaz/mutex.h>
+#include <yaz/test.h>
+#include <yaz/log.h>
+
+static void tst(void)
+{
+ YAZ_MUTEX p = 0;
+
+ yaz_mutex_create(&p);
+ YAZ_CHECK(p);
+ yaz_mutex_enter(p);
+ yaz_mutex_leave(p);
+ yaz_mutex_destroy(&p);
+ YAZ_CHECK(p == 0);
+
+ yaz_mutex_create(&p);
+ YAZ_CHECK(p);
+ yaz_mutex_set_name(p, YLOG_LOG, "mymutex");
+ yaz_mutex_enter(p);
+ yaz_mutex_leave(p);
+ yaz_mutex_destroy(&p);
+ YAZ_CHECK(p == 0);
+}
+
+int main (int argc, char **argv)
+{
+ YAZ_CHECK_INIT(argc, argv);
+ YAZ_CHECK_LOG();
+ tst();
+ YAZ_CHECK_TERM;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+