public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Multi-Threaded Program in eCos
@ 2001-08-09 18:27 Timothy Chow
  2001-08-13  3:44 ` Rafael Rodríguez Velilla
  0 siblings, 1 reply; 2+ messages in thread
From: Timothy Chow @ 2001-08-09 18:27 UTC (permalink / raw)
  To: ecos-discuss

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.

The problem is, some threads with greater thread delay
will stop totally after a while, and only those
threads with smaller delay will keep running. The
funny thing is those "stopped" threads will "resume"
and run like the normal way after being stopped for a
while. And the cycle goes on ...

Any suggestions?


Thanks,
Tim

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] Multi-Threaded Program in eCos
  2001-08-09 18:27 [ECOS] Multi-Threaded Program in eCos Timothy Chow
@ 2001-08-13  3:44 ` Rafael Rodríguez Velilla
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael Rodríguez Velilla @ 2001-08-13  3:44 UTC (permalink / raw)
  To: ecos

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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-08-13  3:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-09 18:27 [ECOS] Multi-Threaded Program in eCos Timothy Chow
2001-08-13  3:44 ` Rafael Rodríguez Velilla

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).