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


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/


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