* Sebastian Hammer, Adam Dickmeiss
*
* $Log: mfile.c,v $
- * Revision 1.38 2000-03-20 19:08:35 adam
+ * Revision 1.39 2000-05-05 13:48:03 adam
+ * Fixed locking for metafiles.
+ *
+ * Revision 1.38 2000/03/20 19:08:35 adam
* Added remote record import using Z39.50 extended services and Segment
* Requests.
*
if (!meta_f)
{
meta_f = (meta_file *) xmalloc(sizeof(*meta_f));
+ zebra_mutex_init (&meta_f->mutex);
meta_f->ma = ma;
meta_f->next = ma->mfiles;
meta_f->open = 0;
int dummy;
# endif
#endif
+ int state;
} Zebra_mutex;
YAZ_EXPORT int zebra_mutex_init (Zebra_mutex *p);
#include <assert.h>
+#include <stdio.h>
#include <zebra-lock.h>
+
int zebra_mutex_init (Zebra_mutex *p)
{
+ if (p->state == 1)
+ {
+ fprintf (stderr, "zebra_mutex_init. state=%d\n", p->state);
+ }
+ p->state = 1;
#if HAVE_PTHREAD_H
pthread_mutex_init (&p->mutex, 0);
#endif
int zebra_mutex_destroy (Zebra_mutex *p)
{
+ --(p->state);
+ if (p->state != 0)
+ {
+ fprintf (stderr, "zebra_mutex_destroy. state = %d\n", p->state);
+ }
#if HAVE_PTHREAD_H
pthread_mutex_destroy (&p->mutex);
#endif
int zebra_mutex_lock (Zebra_mutex *p)
{
+ if (p->state != 1)
+ {
+ fprintf (stderr, "zebra_mutex_lock. state = %d\n", p->state);
+ }
#if HAVE_PTHREAD_H
pthread_mutex_lock (&p->mutex);
#endif
int zebra_mutex_unlock (Zebra_mutex *p)
{
+ if (p->state != 1)
+ {
+ fprintf (stderr, "zebra_mutex_unlock. state = %d\n", p->state);
+ }
#if HAVE_PTHREAD_H
pthread_mutex_unlock (&p->mutex);
#endif
# Z'mbol makefile for MS NMAKE
-# $Id: makefile,v 1.4 2000-04-19 14:35:59 adam Exp $
+# $Id: makefile,v 1.5 2000-05-05 13:48:03 adam Exp $
###########################################################
############### Parameters
###########################################################
-DEBUG=0 # 0 for release, 1 for debug
+DEBUG=1 # 0 for release, 1 for debug
default: all
###########################################################
#
# $Log: makefile,v $
-# Revision 1.4 2000-04-19 14:35:59 adam
+# Revision 1.5 2000-05-05 13:48:03 adam
+# Fixed locking for metafiles.
+#
+# Revision 1.4 2000/04/19 14:35:59 adam
# WIN32 update (this version is known not to work on Windows).
#
# Revision 1.3 2000/04/17 14:22:00 adam