public inbox for
 help / color / mirror / Atom feed
From: Nick Garnett <>
Subject: Re: [ECOS] cyg_flag_timed_wait doesn't seem to work as expected
Date: Fri, 27 May 2016 16:31:00 -0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <07FFDDED6CBCCE4E9FBD46AEC3EBFD4F02C50652@exchange>

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?

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.

The solution is to use cyg_current_time()+3000 in the timeout argument.

Nick Garnett                                         Kernel Architect
eCosCentric Limited    The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.        +44 1223 245571
Registered in England and Wales:                      Reg No: 4422071

Before posting, please read the FAQ:
and search the list archive:

  parent reply	other threads:[~2016-05-27 16:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-27 13:29 Michael W. Ellis
2016-05-27 15:53 ` AW: " Richard Rauch
2016-05-27 16:31 ` Nick Garnett [this message]
2016-05-27 20:46   ` Michael W. Ellis
2016-06-16 13:26 ` [ECOS] eCos Configuration Tool clewan and rebuild Michael W. Ellis
2016-06-16 17:09   ` [ECOS] " Grant Edwards
2016-06-16 21:18     ` Michael W. Ellis
2016-06-16 21:41       ` Grant Edwards
2016-06-16 23:05         ` Alex Schuilenburg
2016-06-17  4:05           ` AW: " Richard Rauch
2016-06-17 10:10             ` Alex Schuilenburg
2016-06-18 12:01               ` AW: " Richard Rauch
2016-06-18 13:20                 ` Alex Schuilenburg
2016-06-30 14:53         ` [ECOS] Input from debug console Michael W. Ellis
2016-06-30 16:01           ` Michael W. Ellis
2016-06-30 16:09             ` Evgeniy Dushistov
2016-06-30 17:52             ` [ECOS] " Grant Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).