-
Notifications
You must be signed in to change notification settings - Fork 131
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
Fix FreeBSD build and test #1149
Conversation
@swift-ci please test |
@@ -53,6 +56,10 @@ public class Synchronized<Value> { | |||
lock = UnsafeMutablePointer<pthread_mutex_t>.allocate(capacity: 1) | |||
lock.initialize(to: pthread_mutex_t()) | |||
pthread_mutex_init(lock, nil) | |||
#elseif os(FreeBSD) | |||
lock = UnsafeMutablePointer<pthread_mutex_t?>.allocate(capacity: 1) | |||
lock.initialize(to: nil) |
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.
Should this be an initialized to pthread_mutex_t()
like above (or rolled into the same #if
scopes as the above?
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.
he main difference on BSD (FreeBSD, OpenBSD) platforms is that the lock type is a pthread_mutex_t?
instead of pthread_mutex_t
. This is due to on the BSDs, pthread_mutex_t
is in fact a struct pthread_mutex
pointer, thus it does not come with a default .init()
constructor and we need initialize it to nil
instead.
ref: http://fxr.watson.org/fxr/source/sys/_pthreadtypes.h?v=FREEBSD-13-STABLE;im=10#L71
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. This looks good to me.
@swift-ci please test |
Summary
This PR fixes building swift-docc on x86_64 FreeBSD
Testing
All test passes!