Is the asynchronous IO file stream safe?

Is an asynchronous IO file similar to FileStream.BeginWrite thread safe? If not, then you need to wrap "SyncLock", which means that it still blocks the stream.

+3
source share
3 answers

FileStream.BeginWritealready starts a new thread to access files. You do not need to run FileStream.BeginWritein a separate thread (because it will be a thread in a thread). On the other hand, several functions FileStream.BeginWriteshould not access the same file at the same time.

+4
source

In addition, if a resource accesses multiple threads, this means that it is a shared resource, and there are many resources about their use in C #.

+4

FileStream.BeginRead/BeginWrite , - - .

, BeginRead/BeginWrite / , (, Seek) , / .

, Microsoft FileStream " ". BeginReadCore BeginWriteCore.

: -, , P/Invoke ReadFile/WriteFile.

+1

All Articles