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]

Re: sscanf() vs. fgetc()


Robin Farine wrote:
> 
> Hi Peter,
> 
> Peter Graf <p.graf@itknet.de> writes:
> 
> > Hi,
> >
> > after problems in a large context, I have cut things down to a short
> > example for a phenomenon I can't explain myself.
> >
> > I create and resume a new thread which uses fgetc() on a serial port, in an
> > infinite loop.
> > This new thread has a higher priority than the old one.
> > If no characters are received, fgetc blocks and the old thread continues.
> >
> > So far so good.
> >
> > But when I use sscanf() in the old thread, it hangs.
> > Even if the new process completes fgetc(), because characters are received,
> > the old process won't get any further.
> 
> I suppose that only one thread at a time can read characters from a serial
> port.

Yes, but *s*scanf() isn't reading from the serial port.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/


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