From owner-freebsd-java Wed Aug 14 9:35:28 2002 Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 940CE37B400 for ; Wed, 14 Aug 2002 09:35:24 -0700 (PDT) Received: from ns.yogotech.com (ns.yogotech.com [206.127.123.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id D58FA43E42 for ; Wed, 14 Aug 2002 09:35:23 -0700 (PDT) (envelope-from nate@yogotech.com) Received: from emerger.yogotech.com (emerger.yogotech.com [206.127.123.131]) by ns.yogotech.com (8.9.3/8.9.3) with ESMTP id KAA05211; Wed, 14 Aug 2002 10:35:18 -0600 (MDT) (envelope-from nate@yogotech.com) Received: (from nate@localhost) by emerger.yogotech.com (8.12.5/8.12.5) id g7EGZFHV080906; Wed, 14 Aug 2002 10:35:15 -0600 (MDT) (envelope-from nate) From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15706.34499.692329.335121@emerger.yogotech.com> Date: Wed, 14 Aug 2002 10:35:15 -0600 To: Huang wen hui Cc: "Bill Huey (Hui)" , java Subject: Re: Hotspot vm is extremely slower than nojit vm on current ? In-Reply-To: <3D5A0EBC.9060706@mail.gddsn.org.cn> References: <3D59C6A4.5020708@mail.gddsn.org.cn> <20020814030231.GA4285@gnuppy.monkey.org> <3D5A0EBC.9060706@mail.gddsn.org.cn> X-Mailer: VM 7.07 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid Reply-To: nate@yogotech.com (Nate Williams) Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org > >>Mostly hotspot vm is stable and fast, but I got problem with Thread.sleep. > >>Look at the following simple program, on current hotspot vm is extreamly > >>slow. This is probably unrelated, but you should note that you need to use synchronization on bQuit in order for it to be safely set. Otherwise, it is OK for the Timer thread to cache it's value (set to FALSE) and continue to use that value, so it may not pick up the new setting when you want it to. public class Timer extends Thread { private static ThreadGroup tGroup = new ThreadGroup("Timer"); // Number of seconds in each timer cycle int m_cycle; private Object quitLock = new Object(); private boolean bQuit = false; public Timer(int cycle) { super(tGroup,"TimerThread"); m_cycle = cycle; } public void run() { this.setName("TimerThread"); // Loop until stopped while (!done()) { try { // Sleep for the clock cycle sleep(m_cycle * 1000); } catch (InterruptedException ex) { // Ignored } // Fire a TimerEvent if (m_timerListener != null) { m_timerListener.TimerEvent(m_object); } } public void quit() { synchronized (quitLock) { bQuit = true; } } private boolean done() { synchronized (quitLock) { return (bQuit); } } Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message