asynchronous disk write

Hi,

I am wondering if there is a way to do asynchronous write on disk with QNX.
In my application, I don’t want the I/O functions to block until the
operation completes.

Any help we’ll be appreciated.
Thanks.

Djibril NDIAYE wrote:

Hi,

I am wondering if there is a way to do asynchronous write on disk with QNX.
In my application, I don’t want the I/O functions to block until the
operation completes.

Any help we’ll be appreciated.

As you are probably aware asynchronous operations (i.e. aio_* ) aren’t
currently supported; however, a dedicated thread and a queue should do
the job, without too much additional effort (and if you use Posix
threads, it should be just as portable).

Rennie

Ok. I didn’t know that async operations are not supported on QNX & Neutrino.

Thanks for your help. I’ll consider using the Thread solution.

Thanks again.

“Rennie Allen” <rgallen@attbi.com> wrote in message
news:al408d$32e$1@inn.qnx.com

Djibril NDIAYE wrote:
Hi,

I am wondering if there is a way to do asynchronous write on disk with
QNX.
In my application, I don’t want the I/O functions to block until the
operation completes.

Any help we’ll be appreciated.

As you are probably aware asynchronous operations (i.e. aio_* ) aren’t
currently supported; however, a dedicated thread and a queue should do
the job, without too much additional effort (and if you use Posix
threads, it should be just as portable).

Rennie

Djibril NDIAYE <djibril.ndiaye@opal-rt.com> wrote:

Hi,

I am wondering if there is a way to do asynchronous write on disk with QNX.
In my application, I don’t want the I/O functions to block until the
operation completes.

aio_* arent’ documented.

But, most write()s to disk when working through the filesystem will
return when the data has been copied into fsys cache, rather than waiting
for the data to be written to disk. (Unless you explicitly request
otherwise, say by opening the file with O_DSYNC or O_SYNC.) Depending
on your needs, having a sufficiently large Fsys cache may actually
satisfy your requirements without having to get into the mess of creating
a thread to handle the IO locally.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Thank you for replying.
I cannot really rely on the cache size.
My application might want to log a huge amount of data to file.
I really need some file io functions that send signals on io completion or
functions that allow users to provide a callback function …
As I am planning to call these functions from a realtime application, they
should not block.

Thanks again.



“David Gibbs” <dagibbs@qnx.com> wrote in message
news:al5kk9$bhk$1@nntp.qnx.com

Djibril NDIAYE <> djibril.ndiaye@opal-rt.com> > wrote:
Hi,

I am wondering if there is a way to do asynchronous write on disk with
QNX.
In my application, I don’t want the I/O functions to block until the
operation completes.

aio_* arent’ documented.

But, most write()s to disk when working through the filesystem will
return when the data has been copied into fsys cache, rather than waiting
for the data to be written to disk. (Unless you explicitly request
otherwise, say by opening the file with O_DSYNC or O_SYNC.) Depending
on your needs, having a sufficiently large Fsys cache may actually
satisfy your requirements without having to get into the mess of creating
a thread to handle the IO locally.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

David Gibbs wrote:

aio_* arent’ documented.

What do you mean they aren’t documented ? They are on my system (QNX6.2NC
from a clean install). They are documented as not being supported.

btw: Relying on caching is not deterministic; an asynchronous thread is.

Rennie

Rennie Allen <rgallen@attbi.com> wrote:

David Gibbs wrote:

aio_* arent’ documented.

What do you mean they aren’t documented ? They are on my system (QNX6.2NC
from a clean install). They are documented as not being supported.

Doh!

What I meant to type is “supported” or “implemented” but somehow
“documented” came out.

btw: Relying on caching is not deterministic; an asynchronous thread is.

I agree. It depends on what you need. An asynchronous thread is
mostly ok… as long as you have enough memory to locally cache the
data, etc. That is, it requires more than just a thread, it also
requires some sort of buffer management.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.