[fpc-pascal] When Pascal code is too fast

ik idokan at gmail.com
Thu Nov 1 09:32:13 CET 2007

On 11/1/07, Marco van de Voort <marcov at stack.nl> wrote:
> > On 11/1/07, Marc Santhoff <M.Santhoff at t-online.de> wrote:
> > > Something like
> > >
> > >         fcntl(fileno(stderr), F_GETFL) & O_NONBLOCK
> > >
> > > or the pascal equivalent should do.
> >
> > I'm getting -1 from fpWrite for a "long" period of time, like 6-7 loop
> > returns before it can continue getting the my next content, only to
> > have the same problem repeated...
> Check errno, an if it is EAGAIN, try... again :-)
> Maybe some libc versions do this in their libc (as opposed to kernel) read/write
> versions already.

I found a scary thing with fpOpen after using strace:
It adds me the flag O_LARGEFILE. Another issue that was not the same
as the C code, and now it seems to solve the problem completely was
that I opened a device as a non blocking, while the C was blocking.
removing the O_NONBLOCK solved the problem completely.
And yes strace showed me the EAGAIN flag :(

BTW it is a C vs Pascal thingy... Linux and libc are written in C... ;)

Thank you all for the help,


More information about the fpc-pascal mailing list