-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Implement flock_*
for Win32
#12766
Conversation
Does this obsolete #12681? |
Yes, this is a superior fiber-aware implementation. But I see there are some parts in that which we should keep. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks 🚀
LOCKFILE_FAIL_IMMEDIATELY = DWORD.new(0x00000001) | ||
LOCKFILE_EXCLUSIVE_LOCK = DWORD.new(0x00000002) |
There was a problem hiding this comment.
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?
LOCKFILE_FAIL_IMMEDIATELY = DWORD.new(0x00000001) | |
LOCKFILE_EXCLUSIVE_LOCK = DWORD.new(0x00000002) | |
LOCKFILE_FAIL_IMMEDIATELY = 0x00000001 | |
LOCKFILE_EXCLUSIVE_LOCK = 0x00000002 |
There was a problem hiding this comment.
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:
crystal/src/lib_c/x86_64-windows-msvc/c/fileapi.cr
Lines 10 to 13 in 022e1f9
FILE_TYPE_CHAR = DWORD.new(0x2) | |
FILE_TYPE_DISK = DWORD.new(0x1) | |
FILE_TYPE_PIPE = DWORD.new(0x3) | |
FILE_TYPE_UNKNOWN = DWORD.new(0x0) |
The implementation is analog to #12728 just for the Win32 API.
Closes #12681