[asterisk-commits] tilghman: trunk r88211 - in /trunk: ./ include/asterisk/lock.h
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Nov 2 08:10:29 CDT 2007
Author: tilghman
Date: Fri Nov 2 08:10:29 2007
New Revision: 88211
URL: http://svn.digium.com/view/asterisk?view=rev&rev=88211
Log:
Merged revisions 88210 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r88210 | tilghman | 2007-11-02 08:03:03 -0500 (Fri, 02 Nov 2007) | 5 lines
Fix build on Solaris
Reported by: snuffy
Patch by: ys
Closes issue #11143
........
Modified:
trunk/ (props changed)
trunk/include/asterisk/lock.h
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/lock.h?view=diff&rev=88211&r1=88210&r2=88211
==============================================================================
--- trunk/include/asterisk/lock.h (original)
+++ trunk/include/asterisk/lock.h Fri Nov 2 08:10:29 2007
@@ -675,11 +675,11 @@
int res;
pthread_mutexattr_t attr;
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for already init'ed mutex for BSD */
- if (*pmutex != PTHREAD_MUTEX_INITIALIZER)
+ if (*pmutex != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER))
return 0;
-#endif
+#endif /* BSD */
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, AST_MUTEX_KIND);
@@ -692,42 +692,42 @@
static inline int ast_mutex_unlock(ast_mutex_t *pmutex)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized mutex for BSD */
- if (*pmutex == PTHREAD_MUTEX_INITIALIZER) {
+ if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
ast_mutex_init(pmutex);
return 0;
}
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_mutex_unlock(pmutex);
}
static inline int ast_mutex_destroy(ast_mutex_t *pmutex)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
- if (*pmutex == PTHREAD_MUTEX_INITIALIZER)
+#ifdef BSD
+ if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER))
return 0;
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_mutex_destroy(pmutex);
}
static inline int ast_mutex_lock(ast_mutex_t *pmutex)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized mutex for BSD */
- if (*pmutex == PTHREAD_MUTEX_INITIALIZER)
+ if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER))
ast_mutex_init(pmutex);
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
__MTX_PROF(pmutex);
}
static inline int ast_mutex_trylock(ast_mutex_t *pmutex)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized mutex for BSD */
- if (*pmutex == PTHREAD_MUTEX_INITIALIZER)
+ if (*pmutex == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER))
ast_mutex_init(pmutex);
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_mutex_trylock(pmutex);
}
@@ -1037,11 +1037,11 @@
int res;
pthread_rwlockattr_t attr;
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for already init'ed lock for BSD */
if (*prwlock != ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE))
return 0;
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
pthread_rwlockattr_init(&attr);
#ifdef HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP
@@ -1055,67 +1055,67 @@
static inline int ast_rwlock_destroy(ast_rwlock_t *prwlock)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized mutex for BSD */
if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE))
return 0;
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_rwlock_destroy(prwlock);
}
static inline int ast_rwlock_unlock(ast_rwlock_t *prwlock)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized lock for BSD */
if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
ast_rwlock_init(prwlock);
return 0;
}
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_rwlock_unlock(prwlock);
}
static inline int ast_rwlock_rdlock(ast_rwlock_t *prwlock)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized lock for BSD */
if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
ast_rwlock_init(prwlock);
}
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_rwlock_rdlock(prwlock);
}
static inline int ast_rwlock_tryrdlock(ast_rwlock_t *prwlock)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized lock for BSD */
if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
ast_rwlock_init(prwlock);
}
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_rwlock_tryrdlock(prwlock);
}
static inline int ast_rwlock_wrlock(ast_rwlock_t *prwlock)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized lock for BSD */
if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
ast_rwlock_init(prwlock);
}
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_rwlock_wrlock(prwlock);
}
static inline int ast_rwlock_trywrlock(ast_rwlock_t *prwlock)
{
-#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
+#ifdef BSD
/* Check for uninitialized lock for BSD */
if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
ast_rwlock_init(prwlock);
}
-#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+#endif /* BSD */
return pthread_rwlock_trywrlock(prwlock);
}
#endif /* !DEBUG_THREADS */
More information about the asterisk-commits
mailing list