eCos Home

RedBoot Home


About eCos

Supported Hardware

Downloading and Installation

Documentation

FAQ

Mailing lists

Problems

Licensing

Anonymous CVS

Contributions and Third Party Projects

eCos
(Answer) (Category) eCos FAQ : (Category) Miscellaneous :
My simple program should sleep, but it just hangs
This simple little program may not work.

  #include <stdio.h>
  int main(void) {
    printf("Hello, world!  Now sleeping for 5 seconds.\n");
    cyg_thread_delay(5*100);
    printf("Back from the dead :-)\n");
  }

Why?  Because "cyg_thread_delay()" takes a cyg_tick_count_t argument, which
is typically a "long long" value.  The compiler doesn't know this and without
any sort of prototypes and/or casts, it will send the wrong sort of value
to cyg_thread_delay().  In most cases, this will cause an arbitrarily long
delay!

Solution?  Simply add this line:
  #include <cyg/kernel/kapi.h>
This will define the native eCos kernel API, as well as prototypes for
all of the kernel functions.  et voila!
Previous: (Answer) Where's the Memory Layout Tool?
This document is: http://ecos.sourceware.org/fom/ecos?file=94
[Search] [Appearance]
This is a Faq-O-Matic 2.717.

Send any queries about the contents of this FAQ to the ecos-discuss mailing list
Send any operational queries about this FAQ to the eCos maintainers