This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Pthread problem
On Thu, Feb 14, 2008 at 09:07:05AM -0400, Davies, Greg wrote:
> Hi,
> I'm having problems when I try to run more than two pthreads at
> the same time. This is on a SAM7SE-EK board using the SAM7S-EK eCos
> configuration.
>
> The threads start up correctly and I hit the main loop of all of
> them. Inside each main loop is a sched_yield() after it's done the main
> work. After the last thread yields, control never returns to one of my
> threads. I tried taking out all the yields, and letting ecos' preemption
> take care of when to switch context, but when I do that, I only ever hit
> the main loop of one of my threads. I also thought it might be a problem
> with the priority of the created threads being lower than that of the
> idle thread, but I haven't explored that possibility yet.
>
> Is there something different about the way pthreads work in eCos
> (the same code ran in linux)? I using the library the way I should be,
> should I be sleeping instead of yielding? Could there be a configuration
> item that could be causing this?
Problems like this are typically to do with the stack being too small
and you overwrite the thread structure. Turn on INFRA_DEBUG and try
with bigger stacks.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss