From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28896 invoked by alias); 7 Dec 2006 11:14:21 -0000 Received: (qmail 28888 invoked by uid 22791); 7 Dec 2006 11:14:21 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 07 Dec 2006 11:14:13 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id kB7BEBfJ021753 for ; Thu, 7 Dec 2006 06:14:11 -0500 Received: from zebedee.littlepinkcloud.COM (vpn-14-11.rdu.redhat.com [10.11.14.11]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id kB7BE8Xa028621; Thu, 7 Dec 2006 06:14:09 -0500 Received: from littlepinkcloud.COM (localhost.localdomain [127.0.0.1]) by zebedee.littlepinkcloud.COM (8.13.6/8.13.5) with ESMTP id kB7BE6qZ027185; Thu, 7 Dec 2006 11:14:07 GMT Received: (from aph@localhost) by littlepinkcloud.COM (8.13.6/8.13.5/Submit) id kB7BE0aD027179; Thu, 7 Dec 2006 11:14:00 GMT MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17783.63352.567891.602074@zebedee.pink> Date: Thu, 07 Dec 2006 11:14:00 -0000 From: Andrew Haley To: Mohan Embar Cc: java-patches@gcc.gnu.org, Adam Megacz , tromey@redhat.com Subject: Re: Patch [ecj]: Fix cross-configury issues / compile ecj.jar for non-shared builds In-Reply-To: References: X-Mailer: VM 7.19 under Emacs 21.4.1 X-IsSubscribed: yes Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2006-q4/txt/msg00223.txt.bz2 Mohan Embar writes: > > I'm feeling a bit burned out, so I'm not going to get to fixing > this up: > > http://gcc.gnu.org/ml/java-patches/2006-q4/msg00209.html > > ...right away. (See the followups for Andrew's feedback.) > If anyone (Adam) wants to take this from me, > be my guest. Otherwise, I'll get to it next week or so. Fair enough. The Linux code is more complicated than it needs to be, anyway. What we really need, rather than imitating the Linux code, is the best Windows-specific way to do it. >From what I can determine by scanning the net, this is probably a call to WaitForSingleObject() in park() and a call to SetEvent() in unpark(). (See http://www.codersource.net/win32_waitforsingleobject.html, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/waitforsingleobject.asp.) It doesn't have to be anything more complicated than that. So, apart from the timer code, park() and unpark() may be as simple as this: void _Jv_ThreadPark (jboolean isAbsolute, jlong time) { /* ... */ /* If we have a permit, return immediately. */ if (compare_and_swap (ptr, Thread::THREAD_PARK_PERMIT, Thread::THREAD_PARK_RUNNING)) return; /* ... */ if (compare_and_swap (ptr, Thread::THREAD_PARK_RUNNING, Thread::THREAD_PARK_PARKED)) { WaitForSingleObject (nt->park_event, millis); /* If we were unparked by some other thread, this will already be in state THREAD_PARK_RUNNING. If we timed out, we have to do it ourself. */ compare_and_swap (ptr, Thread::THREAD_PARK_PARKED, Thread::THREAD_PARK_RUNNING); } } void _Jv_ThreadUnpark (::java::lang::Thread *thread) { /* ... */ /* If this thread is in state RUNNING, give it a permit and return immediately. */ if (compare_and_swap (ptr, Thread::THREAD_PARK_RUNNING, Thread::THREAD_PARK_PERMIT)) return; /* If this thread is parked, put it into state RUNNING and send it a signal. */ if (compare_and_swap (ptr, Thread::THREAD_PARK_PARKED, Thread::THREAD_PARK_RUNNING)) { SetEvent (nt->park_event); } } Andrew.