From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26794 invoked by alias); 15 Jul 2002 03:53:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26787 invoked from network); 15 Jul 2002 03:53:33 -0000 Received: from unknown (HELO grante.dsl.visi.com) (208.42.141.248) by sources.redhat.com with SMTP; 15 Jul 2002 03:53:33 -0000 Received: (qmail 1248 invoked by uid 500); 15 Jul 2002 03:55:02 -0000 Date: Mon, 15 Jul 2002 00:28:00 -0000 From: Grant Edwards To: Andrew Cagney Cc: Momchil Velikov , gdb-patches@sources.redhat.com Subject: Re: RDI code busy-waiting on running target? Message-ID: <20020714225500.A1054@grante.dsl.visi.com> References: <20020711175854.A29971@visi.com> <20020711184343.A4472@visi.com> <20020712102650.A6637@visi.com> <20020712130727.A7707@visi.com> <3D31AC1D.5060906@ges.redhat.com> <87ele68cd1.fsf@fadata.bg> <3D31BC77.5020700@ges.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3D31BC77.5020700@ges.redhat.com>; from ac131313@ges.redhat.com on Sun, Jul 14, 2002 at 02:01:27PM -0400 X-SW-Source: 2002-07/txt/msg00315.txt.bz2 On Sun, Jul 14, 2002 at 02:01:27PM -0400, Andrew Cagney wrote: > > "Andrew" == Andrew Cagney writes: > >>> + struct timeval timeout; > >>> + timeout.tv_sec = 0; > >>> + timeout.tv_usec = 10000; > >>> + > >>> + select(0,0,0,0,&timeout); > > > > Andrew> Doing a select on nothing strikes me as wrong. How is this code > > Andrew> detecting that something is ``ready''? It has no way of knowing. That's the whole problem. There is no way: it's a busy-wait polling loop. > > Timeout. AFAIK, the only option for high-resolution sleep in systems > > lacking ``nanosleep''. > > If it is a timeout, it should be waiting for min (time until next > timeout, gui keep alive delta). Sorry, I've no idea what that means. Care to explain? If you want the wait to be for some value other than 10ms, that's fine with me. I was trying to make the mininum change possible while still meeting my goal of not sucking up all of the CPU time. How long do you want it? 20ms? 50ms? 100ms? Much longer than 100ms is probably going to be noticable. -- Grant Edwards grante@visi.com