public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Only use __gthread_yield if gthreads is available
@ 2021-06-29 21:09 Matheus Castanho
  2021-06-29 21:27 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Matheus Castanho @ 2021-06-29 21:09 UTC (permalink / raw)
  To: libstdc++

When building libstdc++ with --disable-threads g++ complains that no
__gthread_yield declaration is available. The code should check
_GLIBCXX_HAS_GTHREADS before trying to use it.

libstdc++-v3/ChangeLog:

        * include/std/mutex (__lock_impl): Check _GLIBCXX_HAS_GTHREADS before
        using __gthread_yield
---
 libstdc++-v3/include/std/mutex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index eeb51fdb840..7ab4ee12690 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -618,7 +618,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 		      return;
 		    }
 		}
-#ifdef _GLIBCXX_USE_SCHED_YIELD
+#if defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD
 		__gthread_yield();
 #endif
 		constexpr auto __n = 1 + sizeof...(_L1);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libstdc++: Only use __gthread_yield if gthreads is available
  2021-06-29 21:09 [PATCH] libstdc++: Only use __gthread_yield if gthreads is available Matheus Castanho
@ 2021-06-29 21:27 ` Jonathan Wakely
  2021-06-30 12:40   ` Matheus Castanho
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2021-06-29 21:27 UTC (permalink / raw)
  To: Matheus Castanho; +Cc: libstdc++

On Tue, 29 Jun 2021, 22:09 Matheus Castanho via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

> When building libstdc++ with --disable-threads g++ complains that no
> __gthread_yield declaration is available. The code should check
> _GLIBCXX_HAS_GTHREADS before trying to use it.
>


Yes, thanks for the patch. Do you have write access? If not I'll commit it
tomorrow.



> libstdc++-v3/ChangeLog:
>
>         * include/std/mutex (__lock_impl): Check _GLIBCXX_HAS_GTHREADS
> before
>         using __gthread_yield
> ---
>  libstdc++-v3/include/std/mutex | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/std/mutex
> b/libstdc++-v3/include/std/mutex
> index eeb51fdb840..7ab4ee12690 100644
> --- a/libstdc++-v3/include/std/mutex
> +++ b/libstdc++-v3/include/std/mutex
> @@ -618,7 +618,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>                       return;
>                     }
>                 }
> -#ifdef _GLIBCXX_USE_SCHED_YIELD
> +#if defined _GLIBCXX_HAS_GTHREADS && defined _GLIBCXX_USE_SCHED_YIELD
>                 __gthread_yield();
>  #endif
>                 constexpr auto __n = 1 + sizeof...(_L1);
> --
> 2.31.1
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libstdc++: Only use __gthread_yield if gthreads is available
  2021-06-29 21:27 ` Jonathan Wakely
@ 2021-06-30 12:40   ` Matheus Castanho
  2021-07-05 12:26     ` Matheus Castanho
  0 siblings, 1 reply; 5+ messages in thread
From: Matheus Castanho @ 2021-06-30 12:40 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++


Jonathan Wakely <jwakely.gcc@gmail.com> writes:

> On Tue, 29 Jun 2021, 22:09 Matheus Castanho via Libstdc++, <libstdc++@gcc.gnu.org> wrote:
>
>  When building libstdc++ with --disable-threads g++ complains that no
>  __gthread_yield declaration is available. The code should check
>  _GLIBCXX_HAS_GTHREADS before trying to use it.
>
> Yes, thanks for the patch. Do you have write access? If not I'll commit it tomorrow.
>

No, I don't. Could you do it for me?

Thanks,
Matheus Castanho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libstdc++: Only use __gthread_yield if gthreads is available
  2021-06-30 12:40   ` Matheus Castanho
@ 2021-07-05 12:26     ` Matheus Castanho
  2021-07-09 14:20       ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Matheus Castanho @ 2021-07-05 12:26 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++


Ping :)

Matheus Castanho <msc@linux.ibm.com> writes:

> Jonathan Wakely <jwakely.gcc@gmail.com> writes:
>
>> On Tue, 29 Jun 2021, 22:09 Matheus Castanho via Libstdc++, <libstdc++@gcc.gnu.org> wrote:
>>
>>  When building libstdc++ with --disable-threads g++ complains that no
>>  __gthread_yield declaration is available. The code should check
>>  _GLIBCXX_HAS_GTHREADS before trying to use it.
>>
>> Yes, thanks for the patch. Do you have write access? If not I'll commit it tomorrow.
>>
>
> No, I don't. Could you do it for me?
>
> Thanks,
> Matheus Castanho


--
Matheus Castanho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libstdc++: Only use __gthread_yield if gthreads is available
  2021-07-05 12:26     ` Matheus Castanho
@ 2021-07-09 14:20       ` Jonathan Wakely
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2021-07-09 14:20 UTC (permalink / raw)
  To: Matheus Castanho; +Cc: libstdc++

Sorry for the delay, I've pushed your patch now.

I keep making the same mistake for __gthread_yield, so maybe we should
change the USE_SCHED_YIELD macro to be defined only when gthreads is also
available.

On Mon, 5 Jul 2021, 13:26 Matheus Castanho, <msc@linux.ibm.com> wrote:

>
> Ping :)
>
> Matheus Castanho <msc@linux.ibm.com> writes:
>
> > Jonathan Wakely <jwakely.gcc@gmail.com> writes:
> >
> >> On Tue, 29 Jun 2021, 22:09 Matheus Castanho via Libstdc++, <
> libstdc++@gcc.gnu.org> wrote:
> >>
> >>  When building libstdc++ with --disable-threads g++ complains that no
> >>  __gthread_yield declaration is available. The code should check
> >>  _GLIBCXX_HAS_GTHREADS before trying to use it.
> >>
> >> Yes, thanks for the patch. Do you have write access? If not I'll commit
> it tomorrow.
> >>
> >
> > No, I don't. Could you do it for me?
> >
> > Thanks,
> > Matheus Castanho
>
>
> --
> Matheus Castanho
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-09 14:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 21:09 [PATCH] libstdc++: Only use __gthread_yield if gthreads is available Matheus Castanho
2021-06-29 21:27 ` Jonathan Wakely
2021-06-30 12:40   ` Matheus Castanho
2021-07-05 12:26     ` Matheus Castanho
2021-07-09 14:20       ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).