X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=util%2Fzebra-lock.c;h=769de1babe451abf192b3130f4551c9dede7b356;hb=c4b3b6322c32ee380e63ff06cabaad213952c195;hp=47b24241d144dc5dc9c21809631d0ae47d445b66;hpb=e5ba12655112ab17ee08e0d048cc5afae8e8c670;p=idzebra-moved-to-github.git 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; }