This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR target/24071


> The alternative would be, inside the mutex:
>
>    if (__gthread_active < 0) {
>      __gthread_active = 0;
>      __gthrw_(pthread_once) (...);
>    }
>
> and then, instead of "__gthread_active++":
>
>    else
>      __gthread_active = 0;
>
> That would make it more obvious that __gthread_active starts out -1, and
> then becomes 0, and then (sometimes) becomes 1.

OK, I'm going to make the change.

> Your version makes me scratch my head wondering if __gthread_active can ever
> be > 1.  (Answer: yes, if three threads reacth __gthread_active_p at once;
> __gthread_trigger will be called once, and all the threads will
> increment __gthread_active_p, which is harmless, but confusing.)

__gthread_active would automatically be 2 at least if the program is threaded.

> It's up to you which version you go with.  Either is fine for mainline
> and for 4.2.

Thanks!

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]