This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Multi-Threaded Program in eCos
- To: ecos <ecos-discuss at sources dot redhat dot com>
- Subject: Re: [ECOS] Multi-Threaded Program in eCos
- From: Rafael Rodríguez Velilla <rrv at tid dot es>
- Date: Mon, 13 Aug 2001 12:16:37 +0200
- Organization: Telefónica I+D
- References: <20010810012706.98885.qmail@web9703.mail.yahoo.com>
Timothy Chow wrote:
> Hello,
>
> I am working on a custom SA1100-based device running
> eCos. I have some problem with multi-threaded
> programs.
>
> I usually have 4 or more threads in a program. Some of
> them are threads for device drivers, so usually they
> are all endless loops (i.e. while(1) {...}).
>
> I have the same priority for every thread, but
> difference thread delay for the while loop in each
> thread. Even if a thread/loop needs to run
> continuously, I will add "cyg_thread_delay(1)" after
> each loop to let the scheduler run.
Why don't you use cyg_thread_yield() instead of cyg_thread_delay. In this
way, once a thread has completed its work it will rotate in the queue of
threads of the same priority.