Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement flock_* for Win32 #12766

Merged

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Nov 19, 2022

The implementation is analog to #12728 just for the Win32 API.

Closes #12681

@HertzDevil
Copy link
Contributor

Does this obsolete #12681?

@straight-shoota
Copy link
Member Author

Yes, this is a superior fiber-aware implementation. But I see there are some parts in that which we should keep.

Copy link
Member

@beta-ziliani beta-ziliani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks 🚀

Comment on lines +48 to +49
LOCKFILE_FAIL_IMMEDIATELY = DWORD.new(0x00000001)
LOCKFILE_EXCLUSIVE_LOCK = DWORD.new(0x00000002)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really needed, right?

Suggested change
LOCKFILE_FAIL_IMMEDIATELY = DWORD.new(0x00000001)
LOCKFILE_EXCLUSIVE_LOCK = DWORD.new(0x00000002)
LOCKFILE_FAIL_IMMEDIATELY = 0x00000001
LOCKFILE_EXCLUSIVE_LOCK = 0x00000002

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily, but that's only because DWORD is equivalent to the default integer type Int32.
Prior evidence:

FILE_TYPE_CHAR = DWORD.new(0x2)
FILE_TYPE_DISK = DWORD.new(0x1)
FILE_TYPE_PIPE = DWORD.new(0x3)
FILE_TYPE_UNKNOWN = DWORD.new(0x0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants