Any way to open a FileStream asynchronously?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to perform the open of a .NET 1.1 FileStream object
asynchrously? My app must open hundreds of files, and I need to reduce the
"blocked" time waiting for these opens to complete. I've considered
performing the open on a separate thread, but that gets complicated in a
hurry.

BTW: I know there is a way to open a FileStream so that it supports async
reads/writes. But that's not what I need to do... I want to perform the open
of the filestream asynchronously, and then perform synchronous reads/writes.

Thanks!

D
 
Unfortunately, I think threading is the only way to go....
Look at it this way - if I can get the hang of it, so can you!!
_______________________________
The Grim Reaper
 
Be careful when opening "hundreds" of files asynchronously! In worst
case u will have "hundreds" of parallel threads accessing your
filesystem, thats not good.
--> Limit the maximum number of threads working.
 
David said:
Is there any way to perform the open of a .NET 1.1 FileStream object
asynchrously? My app must open hundreds of files, and I need to reduce
the
"blocked" time waiting for these opens to complete. I've considered
performing the open on a separate thread, but that gets complicated in a
hurry.

I think you're going to have to go down the multi-threading route. But don't
be scared! Threads look scary the first time you use them, but once you've
figured them out you wonder why you ever found them tricky.

David C
 
David Cartwright said:
I think you're going to have to go down the multi-threading route. But don't
be scared! Threads look scary the first time you use them, but once you've
figured them out you wonder why you ever found them tricky.

I don't know about that. I've been using threads (and writing about
them) for years and I still find them scary and tricky. Getting a
multi-threaded program absolutely right can be very, very difficult,
especially in the face of a memory model implementation which may be
doing much more optimisation than you expect it to.
 
Back
Top