From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19403 invoked by alias); 22 Jun 2007 02:38:54 -0000 Received: (qmail 19381 invoked by uid 48); 22 Jun 2007 02:38:43 -0000 Date: Fri, 22 Jun 2007 02:38:00 -0000 From: "kris dot van dot hees at oracle dot com" To: frysk-bugzilla@sourceware.org Message-ID: <20070622023843.4688.kris.van.hees@oracle.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug general/4688] New: frysk.event.EventLoop.isCurrentThread() sets EventLoop TID X-Bugzilla-Reason: AssignedTo Mailing-List: contact frysk-bugzilla-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: frysk-bugzilla-owner@sourceware.org X-SW-Source: 2007-q2/txt/msg00413.txt.bz2 List-Id: 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.