From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: Robin Farine Cc: Peter Graf , ecos-discuss@sources.redhat.com Subject: Re: [ECOS] sscanf() vs. fgetc() Date: Thu, 12 Jul 2001 03:42:00 -0000 Message-id: <3B4D7F1B.6C5C9040@redhat.com> References: <3.0.5.32.20010712104805.00914420@128.128.128.220> <86sng24g1c.fsf@halftrack.hq.acn-group.ch> X-SW-Source: 2001-07/msg00346.html Robin Farine wrote: > > Hi Peter, > > Peter Graf 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/