This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: sscanf() vs. fgetc()
- To: Peter Graf <p dot graf at itknet dot de>
- Subject: Re: [ECOS] sscanf() vs. fgetc()
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Thu, 12 Jul 2001 11:59:56 +0100
- Cc: ecos-discuss at sources dot redhat dot com
- Organization: Red Hat UK Ltd.
- References: <3.0.5.32.20010712104805.00914420@128.128.128.220>
Peter Graf wrote:
>
> 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.
Hmm....
cyg_thread_create()...
cyg_thread_resume...
fgetc()...
fgetc() done.
fgetc()...
loop...
sprintf...
sscanf...
sscanf done.
loop...
main() finished
This was on a PC target FWIW.
Perhaps you should step into sscanf() and see where it stops. Or if it gets
stuck, press Ctrl-C and then "info threads", then switch to the main thread
and do a backtrace.
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/