This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Why __gthread_active_p() is checked only in few functions?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: niXman <i dot nixman at autistici dot org>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 29 Sep 2014 17:38:10 +0100
- Subject: Re: Why __gthread_active_p() is checked only in few functions?
- Authentication-results: sourceware.org; auth=none
- References: <34ce7e306e6f583704fbafe4c0b040bc at autistici dot org>
On 29 September 2014 16:41, niXman wrote:
>
> Hi,
>
> I trying to understand why '__gthread_active_p()' is checked only in few
> functions, and why exactly in this functions?
>
> For example, '__gthread_active_p()' is used in
> '__gthread_mutex_init_function()' but not used for example in
> '__gthread_[g|s]etspecific()'? Why?
Some of the functions are short and calling them without active
threads does nothing, so there's no need to check.
__ghtread_mutex_init_function makes several calls, so if they are all
going to do nothing then there's no point calling any of them.