summaryrefslogtreecommitdiff
path: root/mysys/thr_mutex.c
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-09-20 04:54:10 +0300
committermonty@donna.mysql.com <>2000-09-20 04:54:10 +0300
commitdc4525636ce2912fb9a455503260760621e2eb46 (patch)
tree9809b1ec91af01ed8cc76e542fe1a102e239d9b1 /mysys/thr_mutex.c
parentf2f515e5c2733dfe95471640ff740d0f936579b9 (diff)
downloadmariadb-git-dc4525636ce2912fb9a455503260760621e2eb46.tar.gz
Small bug fixes + code for DELETE QUICK
Diffstat (limited to 'mysys/thr_mutex.c')
-rw-r--r--mysys/thr_mutex.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 9b9c7a8e407..9d9c3a1ce08 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -107,12 +107,17 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
abort();
}
mp->count--;
+#ifdef __WIN__
+ pthread_mutex_unlock(&mp->mutex);
+ error=0;
+#else
error=pthread_mutex_unlock(&mp->mutex);
if (error)
{
fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line);
abort();
}
+#endif /* __WIN__ */
pthread_mutex_unlock(&mp->global);
return error;
}
@@ -201,14 +206,23 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
{
+ int error;
if (mp->count != 0)
{
fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n",
mp->file,mp->line, file, line);
abort();
}
+#ifdef __WIN__
+ error=0;
pthread_mutex_destroy(&mp->global);
- return pthread_mutex_destroy(&mp->mutex);
+ pthread_mutex_destroy(&mp->mutex);
+#else
+ if (pthread_mutex_destroy(&mp->global) ||
+ pthread_mutex_destroy(&mp->mutex))
+ error=1;
+#endif
+ return error;
}
#endif /* THREAD && SAFE_MUTEX */