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: Time slice is not happening quiet alright


"Mike A" <embeddedeng@hotmail.com> writes:

> So, You mean that there is some code within printf that blocks the
> scheduler (something like a schedule_lock), or which prevents the
> running task from giving up the CPU.
> Wonderful!

No, you have misunderstood. The eCos C library is thread safe, so
whenever an IO operation takes place, such as prinyf(), a lock
associated with the stream is taken. Any other thread that tries to do
IO on the same stream will be blocked until the first thread releases
it. This is standard mutual exclusion. Any thread that is not doing IO
on that stream is not affected in any way.

In your program's case, both your threads got serialized by the lock
on the standard IO stream. Giving the non-intuitive results you saw.

> 
> Now one more question.
> Is there a document that talks about this? If there is let me know.
> 

Nothing explicit. This is standard C library behaviour.

-- 
Nick Garnett - eCos Kernel Architect
http://www.eCosCentric.com/


-- 
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]