From c4b3b6322c32ee380e63ff06cabaad213952c195 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 19 Apr 2000 14:35:59 +0000 Subject: [PATCH] WIN32 update (this version is known not to work on Windows). --- include/zebra-lock.h | 11 +++++++++-- index/zebraapi.c | 8 ++++---- util/zebra-lock.c | 12 ++++++++++++ win/makefile | 9 +++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/include/zebra-lock.h b/include/zebra-lock.h index 1f4fba6..ccdd95f 100644 --- a/include/zebra-lock.h +++ b/include/zebra-lock.h @@ -2,6 +2,9 @@ #ifndef ZEBRA_LOCK_H #define ZEBRA_LOCK_H +#ifdef WIN32 +#include +#endif #if HAVE_PTHREAD_H #include #endif @@ -11,10 +14,14 @@ YAZ_BEGIN_CDECL typedef struct { -#if HAVE_PTHREAD_H - pthread_mutex_t mutex; +#ifdef WIN32 + CRITICAL_SECTION mutex; #else +# if HAVE_PTHREAD_H + pthread_mutex_t mutex; +# else int dummy; +# endif #endif } Zebra_mutex; diff --git a/index/zebraapi.c b/index/zebraapi.c index 8c4633f..80d362e 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -3,7 +3,10 @@ * All rights reserved. * * $Log: zebraapi.c,v $ - * Revision 1.31 2000-04-05 10:07:02 adam + * Revision 1.32 2000-04-19 14:35:59 adam + * WIN32 update (this version is known not to work on Windows). + * + * Revision 1.31 2000/04/05 10:07:02 adam * Minor zebra compile fix. * * Revision 1.30 2000/04/05 09:49:35 adam @@ -169,10 +172,7 @@ ZebraHandle zebra_open (ZebraService zs) assert (zs); if (zs->stop_flag) - { - zh->errCode = 1019; return 0; - } zh = (ZebraHandle) xmalloc (sizeof(*zh)); diff --git a/util/zebra-lock.c b/util/zebra-lock.c index 47b2424..769de1b 100644 --- a/util/zebra-lock.c +++ b/util/zebra-lock.c @@ -8,6 +8,9 @@ int zebra_mutex_init (Zebra_mutex *p) #if HAVE_PTHREAD_H pthread_mutex_init (&p->mutex, 0); #endif +#ifdef WIN32 + InitializeCriticalSection (&p->mutex); +#endif return 0; } @@ -16,6 +19,9 @@ int zebra_mutex_destroy (Zebra_mutex *p) #if HAVE_PTHREAD_H pthread_mutex_destroy (&p->mutex); #endif +#ifdef WIN32 + DeleteCriticalSection (&p->mutex); +#endif return 0; } @@ -24,6 +30,9 @@ int zebra_mutex_lock (Zebra_mutex *p) #if HAVE_PTHREAD_H pthread_mutex_lock (&p->mutex); #endif +#ifdef WIN32 + EnterCriticalSection (&p->mutex); +#endif return 0; } @@ -32,6 +41,9 @@ int zebra_mutex_unlock (Zebra_mutex *p) #if HAVE_PTHREAD_H pthread_mutex_unlock (&p->mutex); #endif +#ifdef WIN32 + LeaveCriticalSection (&p->mutex); +#endif return 0; } diff --git a/win/makefile b/win/makefile index c2b90fe..b7a43c2 100644 --- a/win/makefile +++ b/win/makefile @@ -1,5 +1,5 @@ # Z'mbol makefile for MS NMAKE -# $Id: makefile,v 1.3 2000-04-17 14:22:00 adam Exp $ +# $Id: makefile,v 1.4 2000-04-19 14:35:59 adam Exp $ ########################################################### ############### Parameters @@ -169,6 +169,7 @@ LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS) # need to be specified, though ZSERVER_OBJS= \ + $(OBJDIR)\kinput.obj \ $(OBJDIR)\zserver.obj ZEBRAIDX_OBJS= \ @@ -183,6 +184,7 @@ APITEST_OBJS= \ $(OBJDIR)\apitest.obj ZEBRALIB_OBJS= \ + $(OBJDIR)\zebra-lock.obj \ $(OBJDIR)\attribute.obj \ $(OBJDIR)\bfile.obj \ $(OBJDIR)\bset.obj \ @@ -390,7 +392,10 @@ $(ALL_OBJS): makefile ########################################################### # # $Log: makefile,v $ -# Revision 1.3 2000-04-17 14:22:00 adam +# 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 # WIN32 update. # # Revision 1.2 2000/02/08 12:34:17 adam -- 1.7.10.4