Skip to content

Implement Lock.swift on Windows #2080

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

Merged
merged 1 commit into from
Apr 13, 2019
Merged

Conversation

gmittert
Copy link
Contributor

@gmittert gmittert commented Apr 9, 2019

No description provided.

@@ -53,6 +57,30 @@ public final class FileLock {
///
/// Note: This method can throw if underlying POSIX methods fail.
public func lock() throws {
#if os(Windows)
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor note on indenting:

Copy link
Contributor

@aciidgh aciidgh left a comment

Choose a reason for hiding this comment

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

Thanks! Looks great, just left some minor notes on indenting.

@gmittert
Copy link
Contributor Author

Fixed up the indenting

@aciidgh
Copy link
Contributor

aciidgh commented Apr 13, 2019

@swift-ci smoke test

@aciidgh
Copy link
Contributor

aciidgh commented Apr 13, 2019

@swift-ci smoke test linux

@@ -36,7 +36,11 @@ enum ProcessLockError: Swift.Error {
/// by mutiple instances of a process. The `FileLock` is not thread-safe.
public final class FileLock {
/// File descriptor to the lock file.
#if os(Windows)
private var h: HANDLE?
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not at least handle instead of h for this variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Renaming to handle would be nice to have. Feel free to make a PR :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -36,7 +36,11 @@ enum ProcessLockError: Swift.Error {
/// by mutiple instances of a process. The `FileLock` is not thread-safe.
public final class FileLock {
/// File descriptor to the lock file.
#if os(Windows)
private var h: HANDLE?
#else
private var fd: CInt?
Copy link
Contributor

Choose a reason for hiding this comment

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

What fd stands for?

Copy link
Contributor

Choose a reason for hiding this comment

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

file descriptor

@aciidgh aciidgh merged commit 9e692e4 into swiftlang:master Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants