Link to home
Start Free TrialLog in
Avatar of jyukes
jyukes

asked on

WriteFile without blocking Critical priority thread


Hi, I have a CRITICAL_PRIORITY thread that must absolutely perform work every 20ms.
From this thread, I try to write a 400 byte message to disk.  However if the disk subsystem is bogged down or other, this can take longer than the acceptable amount of time.

Is there a safe way to write to sume buffered thread that will then write to disk?
But I can't have the Critical thread be interrupted for anything... so how can I pass the data to the other thread properly?

Do I have to use somewhat experimental "lockless" data structures?
Avatar of rcarlan
rcarlan

Open the file with FILE_FLAG_OVERLAPPED and use WriteFileEx to write to it. This will give you async write to file (i.e. WriteFileEx will return immediately).

Radu
Avatar of jyukes

ASKER

Okay I think there are problems with FILE_FLAG_OVERLAPPED though...

"Asynchronous Disk I/O Appears as Synchronous on Windows NT, Windows 2000, and Windows XP"
http://support.microsoft.com/default.aspx?scid=kb;en-us;156932
ASKER CERTIFIED SOLUTION
Avatar of rcarlan
rcarlan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial