public inbox for frysk-bugzilla@sourceware.org
help / color / mirror / Atom feed
From: "kris dot van dot hees at oracle dot com" <sourceware-bugzilla@sourceware.org>
To: frysk-bugzilla@sourceware.org
Subject: [Bug general/4688] New: frysk.event.EventLoop.isCurrentThread() sets EventLoop TID
Date: Fri, 22 Jun 2007 02:38:00 -0000	[thread overview]
Message-ID: <20070622023843.4688.kris.van.hees@oracle.com> (raw)

The event loop TID is initially set to -1, and can be set to a valid TID only
once.  This can currently occur as a result of a call to one of the following
methods:

    1. isCurrentThread() -- return true if the currently executing thread is the
                            event loop thread
    2. runPolling()      -- run the event loop for a given amount of time
    3. runPending()      -- run the event loop until there are no more pending
                            events

It is possible to end up with a race condition between the event loop thread and
any other thread performing operations that are handled differently depending on
whether code is executing on the event loop thread or not.  If a thread other
than the one where the event loop is starting up calls isCurrentThread() prior
to either runPolling() or runPending() has been called, the event loop thread
will be set to the TID of the caller of isCurrentThread().  When the start up of
the event loop reaches the first call to runPolling() or runPending(), it will
try to set the TID, find that it has already been set, and report an error.

Given that isCurrentThread() is a query to determine whether code is executing
on the event loop thread, it should (appropriately) return false when the TID
has not been set yet, because that also indicates that the event loop is not
executing yet.  Setting the TID from this method causes this test for a
condition to have a side effect that can give rise to a race condition.

-- 
           Summary: frysk.event.EventLoop.isCurrentThread() sets EventLoop
                    TID
           Product: frysk
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: general
        AssignedTo: frysk-bugzilla at sourceware dot org
        ReportedBy: kris dot van dot hees at oracle dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4688

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


             reply	other threads:[~2007-06-22  2:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22  2:38 kris dot van dot hees at oracle dot com [this message]
2007-06-22  4:39 ` [Bug general/4688] " kris dot van dot hees at oracle dot com

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

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

  git send-email \
    --in-reply-to=20070622023843.4688.kris.van.hees@oracle.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=frysk-bugzilla@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).