-/* $Id: flock.c,v 1.8 2006-06-27 11:56:29 adam Exp $
+/* $Id: flock.c,v 1.9 2006-06-27 12:24:14 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
ZebraLockHandle zebra_lock_create(const char *dir, const char *name)
{
char *fname = zebra_mk_fname(dir, name);
- struct zebra_lock_info *p;
+ struct zebra_lock_info *p = 0;
ZebraLockHandle h = 0;
assert(initialized);
zebra_mutex_lock(&lock_list_mutex);
+#ifndef WIN32
for (p = lock_list; p ; p = p->next)
if (!strcmp(p->fname, fname))
break;
+#endif
if (!p)
{
p = (struct zebra_lock_info *) xmalloc(sizeof(*p));
p->ref_count++;
h = (ZebraLockHandle) xmalloc(sizeof(*h));
h->p = p;
+#ifndef WIN32
h->write_flag = 0;
+#endif
}
zebra_mutex_unlock(&lock_list_mutex);
xfree(fname); /* free it - if it's still there */
zebra_mutex_unlock(&h->p->file_mutex);
zebra_lock_rdwr_wlock(&h->p->rdwr_lock);
-#endif
h->write_flag = 1;
+#endif
return r;
}
initialized = 1;
zebra_mutex_init(&lock_list_mutex);
}
+ yaz_log(log_level, "zebra_flock_init");
}
/*
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tstflock.c,v 1.7 2006-06-27 11:56:29 adam Exp $
+ * $Id: tstflock.c,v 1.8 2006-06-27 12:24:14 adam Exp $
*/
#include <assert.h>
&dwThreadId[i]); /* returns the thread identifier */
}
/* join */
- WaitForMultipleObjects(NUM_THREADS, handles, TRUE, INFINITE);
+ WaitForMultipleObjects(num, handles, TRUE, INFINITE);
}
#endif