This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: (Is main() a normal thread ?) problem was my fault...


The other moral is: compile with -Wall, so that GCC whines about missing
function prototype.

The alternate moral is: if you were compiling with -Wall, and GCC didn't
whine, then please let us know, because that is a bug.

--wpd


> -----Original Message-----
> From: Claudio Leonel [mailto:cls@elaxys.com.br] 
> Sent: Tuesday, September 30, 2003 8:21 AM
> To: Savin Zlobec
> Cc: ecos-discuss@sources.redhat.com
> Subject: [ECOS] (Is main() a normal thread ?) problem was my fault...
> 
> 
> Hi,
> 
> I found the problem why the following program
> does not work as intended:
> ------------------------------------------------
> int main(void) {
>     while (1) {
>        cyg_thread_delay(100);
>     }
> }
> ------------------------------------------------
> 
> It will work if the header file <cyg/kernel/kapi.h>
> is included.
> 
> The reason is that the parameter of cyg_thread_delay()
> is a 64 bit variable. Without the header file, the compiler
> will pass a 32 bit variable and the most significant word
> is undefined, and could be a huge value,
> so cyg_thread_delay() will delay for much more than 100 ticks...
> 
> The problem had nothing to do with main(). In my other
> test program which used cyg_user_start() and another
> thread, the header file was included, so the problem
> didn't occur...
> 
> The moral of the story for me is:
>    Allways include the header files !!!
> 
> 
> Regards,
> Claudio L. Salvadori
> 
> 
> -- 
> Before posting, please read the FAQ: 
> http://sources.redhat.com/fom/ecos
> and search the list 
> archive: http://sources.redhat.com/ml/ecos-discuss
> 

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]