projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 5.9.0
[yaz-moved-to-github.git]
/
src
/
mutex.c
diff --git
a/src/mutex.c
b/src/mutex.c
index
d1cd50e
..
c4dba48
100644
(file)
--- a/
src/mutex.c
+++ b/
src/mutex.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-38,27
+38,21
@@
#include "mutex-p.h"
#include "mutex-p.h"
-void yaz_mutex_create_attr(YAZ_MUTEX *p, int flags) {
+void yaz_mutex_create(YAZ_MUTEX *p)
+{
if (!*p)
{
*p = (YAZ_MUTEX) malloc(sizeof(**p));
#ifdef WIN32
InitializeCriticalSection(&(*p)->handle);
#elif YAZ_POSIX_THREADS
if (!*p)
{
*p = (YAZ_MUTEX) malloc(sizeof(**p));
#ifdef WIN32
InitializeCriticalSection(&(*p)->handle);
#elif YAZ_POSIX_THREADS
- (*p)->attr = malloc(sizeof( (*p)->attr));
- pthread_mutexattr_init((*p)->attr);
- pthread_mutexattr_settype((*p)->attr, flags);
- pthread_mutex_init(&(*p)->handle, (*p)->attr);
+ pthread_mutex_init(&(*p)->handle, 0);
#endif
(*p)->name = 0;
(*p)->log_level = 0;
}
}
#endif
(*p)->name = 0;
(*p)->log_level = 0;
}
}
-void yaz_mutex_create(YAZ_MUTEX *p) {
- yaz_mutex_create(YAZ_MUTEX *p, 0);
-}
-
void yaz_mutex_set_name(YAZ_MUTEX p, int log_level, const char *name)
{
if (p->name)
void yaz_mutex_set_name(YAZ_MUTEX p, int log_level, const char *name)
{
if (p->name)
@@
-80,7
+74,7
@@
void yaz_mutex_enter(YAZ_MUTEX p)
EnterCriticalSection(&p->handle);
#elif YAZ_POSIX_THREADS
int r = 1; /* signal : not locked (yet) */
EnterCriticalSection(&p->handle);
#elif YAZ_POSIX_THREADS
int r = 1; /* signal : not locked (yet) */
-
+
if (p->log_level)
{ /* debugging */
r = pthread_mutex_trylock(&p->handle);
if (p->log_level)
{ /* debugging */
r = pthread_mutex_trylock(&p->handle);
@@
-148,8
+142,6
@@
void yaz_mutex_destroy(YAZ_MUTEX *p)
#ifdef WIN32
DeleteCriticalSection(&(*p)->handle);
#elif YAZ_POSIX_THREADS
#ifdef WIN32
DeleteCriticalSection(&(*p)->handle);
#elif YAZ_POSIX_THREADS
- pthread_mutexattr_destroy(&(*p)->attr);
- free((*p)->attr);
pthread_mutex_destroy(&(*p)->handle);
#endif
if ((*p)->name)
pthread_mutex_destroy(&(*p)->handle);
#endif
if ((*p)->name)