From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75708 invoked by alias); 27 May 2016 20:46:53 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 75698 invoked by uid 89); 27 May 2016 20:46:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.5 required=5.0 tests=AWL,BAYES_50,RDNS_DYNAMIC,TVD_RCVD_IP autolearn=no version=3.3.2 spammy=U*ecos-discuss-owner, ecos-discuss-owner@ecos.sourceware.org, ecosdiscussownerecossourcewareorg, U*ecos-discuss X-HELO: exchange.hsv.pesa.com Received: from 67-63-150-35.arpa.kmcmail.net (HELO exchange.hsv.pesa.com) (67.63.150.35) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 May 2016 20:46:42 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 27 May 2016 20:46:00 -0000 Message-ID: <07FFDDED6CBCCE4E9FBD46AEC3EBFD4F02C5069B@exchange> In-Reply-To: <57487536.4090201@calivar.com> References: <07FFDDED6CBCCE4E9FBD46AEC3EBFD4F02C50652@exchange> <57487536.4090201@calivar.com> From: "Michael W. Ellis" To: X-IsSubscribed: yes Subject: RE: [ECOS] cyg_flag_timed_wait doesn't seem to work as expected X-SW-Source: 2016-05/txt/msg00003.txt.bz2 > -----Original Message----- > From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss- > owner@ecos.sourceware.org] On Behalf Of Nick Garnett > Sent: Friday, May 27, 2016 11:27 AM > To: ecos-discuss@ecos.sourceware.org > Subject: Re: [ECOS] cyg_flag_timed_wait doesn't seem to work as > expected >=20 >=20 >=20 > On 27/05/16 14:30, Michael W. Ellis wrote: > > I'm running an old version of eCos (2.0.98) from eCosCentric and I'm > > attempting to use cyg_flag_timed_wait to periodically update a > display > > (see code, below). My event flag variable g_flags is initialized > > elsewhere before this thread is created. Other threads access the > > same event flag but use their own bits within the flag. > > > > My problem is with the timed wait behavior of the event flag. At > > startup I see an initial wait of 30 seconds before the first display > > update occurs, but the update occurs continually after the initial > > timeout. The local variable flags always reads 0, indicating timeout > > has occurred. My understanding is that calling cyg_flag_timed_wait > at > > the top of the loop restarts the timer, but this does not seem to be > > the case. What am I missing here? Is there something I must do to > > clear the timeout event? > > >=20 > The problem is your use of 3000 for the timeout. In eCos, timeouts give > the wakeup time, not the duration. So, the first call waits until tick > 3000, but the rest return immediately since it is now past 3000. >=20 > The solution is to use cyg_current_time()+3000 in the timeout argument. >=20 > -- > Nick Garnett Kernel Architect > eCosCentric Limited http://www.eCosCentric.com The eCos experts > Barnwell House, Barnwell Drive, Cambridge, UK. +44 1223 245571 > Registered in England and Wales: Reg No: 4422071 >=20 This makes perfect sense now. I made this change and everything is working as I expect. Thanks, Michael -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss