unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: swapcontext happening on different threads
Date: Tue, 12 Mar 2024 00:24:21 -0700	[thread overview]
Message-ID: <CA+=Sn1mq6CmyQj-bw5=-uNQfzjO+8Qc2LREUFusx0yRcyj-ruQ@mail.gmail.com> (raw)

Reference https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65712 .

I am not 100% sure if this is a valid thing to do.
But take the code in the referenced GCC bug report. Currently since
pthread_self is marked as const, if you swap to a different context
and then have that context be swapped on a different thread, you
might/will get the old value of pthread_self in some cases.

Is this well defined or is this a corner case that was not expected. I
don't see anywhere in the older versions of POSIX that explain what
would happen if you do that. And glibc's documentation does not talk
about this case either.

It would be useful if the documentation talked about this either way.

Thanks,
Andrew Pinski

             reply	other threads:[~2024-03-12  7:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  7:24 Andrew Pinski [this message]
2024-03-12 12:48 ` swapcontext happening on different threads Szabolcs Nagy
2024-03-12 13:47 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+=Sn1mq6CmyQj-bw5=-uNQfzjO+8Qc2LREUFusx0yRcyj-ruQ@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).