This is the mail archive of the frysk-bugzilla@sourceware.org mailing list for the frysk 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]

[Bug general/4688] New: frysk.event.EventLoop.isCurrentThread() sets EventLoop TID


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.


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