Skip to content

Expose existing FileStream.Lock() and FileStream.Unlock() APIs on MacOS/Unix #16325

@xied75

Description

@xied75

Dear Team,

As the subject line states we seek the consideration to add Lock() and Unlock() for FileStream in the contract. The implementation should be straight forward at least for Windows platform. Current .NET 4.61 calls Win32 LockFile underneath:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365202(v=vs.85).aspx

Although we don't have access to LockFile for UWP, we do luckily have the brother of it LockFileEx, which also supports async, which is good news.

I believe for Linux/BSD/Mac there should be easy equivalent to find as locking on file is very common in old days. Will find all the details if the team is willing to consider the proposal.

We could do our own P/Invoke to call the LockFileEx, but it would be much elegant if corefx support that out of box, unless there is significant reason to reject it.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions