-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
NIOConcurrencyHelpers: port to Windows #1403
Conversation
Can one of the admins verify this patch? |
9 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
@@ -160,6 +204,9 @@ public final class ConditionLock<T: Equatable> { | |||
public func lock(whenValue wantedValue: T, timeoutSeconds: Double) -> Bool { | |||
precondition(timeoutSeconds >= 0) | |||
|
|||
#if os(Windows) | |||
fatalError() |
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 needs to be ported over, but cannot be accurate as SleepConditionVariableSRW
takes a relative time rather than absolute time. It also would have a +/-10ns time-frame as timers on Windows have a 10ns granularity.
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.
I don't think I'm overly worried about timer granularity, so I don't really consider that to be a problem. I'm not sure I follow the relative vs absolute time concerns though.
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.
Just that the sleep will not be exactly precise. I will have some overheads due to adjustments for the remaining sleep just in case of a spurious wakeup.
@@ -160,6 +204,9 @@ public final class ConditionLock<T: Equatable> { | |||
public func lock(whenValue wantedValue: T, timeoutSeconds: Double) -> Bool { | |||
precondition(timeoutSeconds >= 0) | |||
|
|||
#if os(Windows) | |||
fatalError() |
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.
I don't think I'm overly worried about timer granularity, so I don't really consider that to be a problem. I'm not sure I follow the relative vs absolute time concerns though.
d3b5993
to
55d1d5f
Compare
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.
Thank you! Looks mostly good, this there’s a synchronisation problem though
55d1d5f
to
67c62c6
Compare
Add support for Windows to the `NIOConcurrencyHelpers`, replacing the `pthreads` usage for Windows threading primitives.
67c62c6
to
cd723ee
Compare
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.
Thank you! LGTM
Add support for Windows to the `NIOConcurrencyHelpers`, replacing the `pthreads` usage for Windows threading primitives. Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
Add support for Windows to the
NIOConcurrencyHelpers
, replacing thepthreads
usage for Windows threading primitives.[One line description of your change]
Motivation:
[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]
Modifications:
[Describe the modifications you've done.]
Result:
[After your change, what will change.]