Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-12

What happened to FileOpen in trunk?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Giuliano Colla

In multi-thread applications in Linux environment, I'm using FIFO's for communicating between threads.

In order to make it work properly, the FIFO must be opened in non blocking mode. Up to fpc 3.0.4 I've been successfully using code like this:

fdc := FileOpen(myFifo,fmOpenWrite or O_NONBLOCK);

now in trunk the call returns forever an EAGAIN error (as if the O_NOBLOCK flag was not forwarded to OS), and to make it work I'm forced to use a call to fpOpen:

fdc := fpOpen(myFifo,O_RDWR or O_NONBLOCK);

which works properly.

Is this an fpc new feature or a bug?

Giuliano

Michael Van Canneyt
to Giuliano Colla
Giuliano Colla wrote 17 lines
In multi-thread applications in Linux environment, I'm using FIFO's for communicating between threads. In order to make it work properly, the FIFO must be opened in non blocking mode. Up to fpc 3.0.4 I've been successfully using code like this: fdc := FileOpen(myFifo,fmOpenWrite or O_NONBLOCK); now in trunk the call returns forever an EAGAIN error (as if the O_NOBLOCK flag was not forwarded to OS), and to make it work I'm forced to use a call to fpOpen: fdc := fpOpen(myFifo,O_RDWR or O_NONBLOCK); which works properly. Is this an fpc new feature or a bug?

Your code was simply lucky to work in the beginning.

It's not guaranteed that passing OS-Specific options to FileOpen will work.

using fpOpen is the correct method, since you're using OS-specific features.

Michael.

Giuliano Colla
to Michael Van Canneyt

Il 27/12/2017 18:40, Michael Van Canneyt ha scritto:

Show quoted text 7 lines
Your code was simply lucky to work in the beginning. It's not guaranteed that passing OS-Specific options to FileOpen will work. using fpOpen is the correct method, since you're using OS-specific features.

Understood. Thanks a lot.

Giuliano