multithreading - non blocking thread-safe file write -
i trying write in file @ different offset locations using threads shouldn't blocked. not sure how proceed same. guessing need open file o_nonblock flag.
is need open file o_nonblock flag , writing process same ?
any sample piece of code helpful explanation
thanks
on unix/linux file descriptors associated files ready read , write. in other words, o_nonblock has no effect on regular files.
normally, writing file copies data kernel page cache , returns. unless file opened o_direct flag, or kernel page cache has many dirty pages in case write becomes blocking.
if need non-blocking writes file either create dedicated thread writing, or use asynchronous i/o.
Comments
Post a Comment