[asterisk-bugs] [JIRA] (ASTERISK-24905) wrong mutex macros in include/asterisk/lock.h

Manuel Meitinger (JIRA) noreply at issues.asterisk.org
Thu Mar 26 10:55:35 CDT 2015


    [ https://issues.asterisk.org/jira/browse/ASTERISK-24905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225610#comment-225610 ] 

Manuel Meitinger commented on ASTERISK-24905:
---------------------------------------------

Thanks for your response. If a patch is necessary to get this issue addressed/fixed, I'll alter the patch of my other issue to include the proper fix mentioned in this issue's description (and not just an {{#ifdef ___CYGWIN___ ...}}) before sending it to the review board.

> wrong mutex macros in include/asterisk/lock.h
> ---------------------------------------------
>
>                 Key: ASTERISK-24905
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24905
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/BuildSystem
>    Affects Versions: 13.2.0
>         Environment: Cygwin, Other
>            Reporter: Manuel Meitinger
>            Assignee: Manuel Meitinger
>
> During configure * checks for {{PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}} and {{PTHREAD_MUTEX_RECURSIVE_NP}}. If not both are defined (e.g. on Cygwin), * sets
> {{PTHREAD_MUTEX_INIT_VALUE}} to {{PTHREAD_MUTEX_INITIALIZER}} which, however, is not recursive and leads to deadlocks.
> The easy solution is to change {{PTHREAD_MUTEX_INITIALIZER}} to {{PTHREAD_RECURSIVE_MUTEX_INITIALIZER}}.
> A better solution is to handle the initializer and the flag separately:
> {code}
> #if defined(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
> #define PTHREAD_MUTEX_INIT_VALUE	PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
> #else
> #define PTHREAD_MUTEX_INIT_VALUE	PTHREAD_RECURSIVE_MUTEX_INITIALIZER
> #endif /* HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */
> #if defined(HAVE_PTHREAD_MUTEX_RECURSIVE_NP)
> #define AST_MUTEX_KIND			PTHREAD_MUTEX_RECURSIVE_NP
> #else
> #define AST_MUTEX_KIND			PTHREAD_MUTEX_RECURSIVE
> #endif /* HAVE_PTHREAD_MUTEX_RECURSIVE_NP */
> {code}
> The latter also works for Cygwin, since Cygwin only supports the _NP initializer but not the _NP flag. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list