-
Notifications
You must be signed in to change notification settings - Fork 44
Fix the build on FreeBSD (and OpenBSD?) #152
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
Conversation
@3405691582 does this build on OpenBSD? |
Some of the changes discussed on #115 are still missing, so with just the patch atop HEAD it doesn't build. If I apply those changes, namely those below, it seems to build:
I tried to run the tests but ran into some other unrelated issues. |
920cb71
to
fd03cf1
Compare
For now, we use Dispatch for AsyncIO and process termination monitoring, since BSDs (including macOS) all use kqueue as the Dispatch backend anyways. Closes swiftlang#115
FYI: Most recent revision builds successfully on OpenBSD! |
} | ||
|
||
// Save the continuation (before calling epoll_ctl, so we don't miss any data) | ||
_registration.withLock { storage in |
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.
Can you elaborate a bit more on why this change is needed?
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.
There's two threads:
- thread A: thread that calls
registerFileDescriptor
- thread B: monitor loop
With the original code, the following ordering could occur:
- (thread A) add file descriptor N to epoll
- (thread B) process event for N
- (thread B) look up continuation <-- continuation is nil!
- (thread A) save continuation <-- too late
This change forces the ordering to become:
- (thread A) save continuation
- (thread A) add file descriptor N to epoll
- (thread B) process event for N
- (thread B) look up continuation <-- continuation cannot be nil
Thanks for the fix! |
For now, we use Dispatch for AsyncIO and process termination monitoring, since BSDs (including macOS) all use kqueue as the Dispatch backend anyways.
This likely also fixes the build on OpenBSD, but I haven't been able to verify that.
Closes #115