-
Notifications
You must be signed in to change notification settings - Fork 1.1k
pthread_spinlock api remaining bsd systems #2246
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
pthread_spinlock api remaining bsd systems #2246
Conversation
Some changes occurred in OpenBSD module cc @semarie |
r? @JohnTitor (rust-highfive has picked a reviewer for you, use r? to override) |
|
||
// pthread.h | ||
|
||
pub struct __c_anonymous_pthread_spinlock { |
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.
pthread_spinlock
struct is internal and isn't in public header on purpose. the visible part is only a pointer, nothing else.
it is the same kind of type as pthread_t
which is defined as pub type pthread_t = ::uintptr_t
in Rust.
@@ -1530,6 +1539,12 @@ extern "C" { | |||
pub fn pthread_main_np() -> ::c_int; | |||
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); | |||
pub fn pthread_stackseg_np(thread: ::pthread_t, sinfo: *mut ::stack_t) -> ::c_int; | |||
pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: ::c_int) -> ::c_int; |
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.
if I don't mess myself, pthread_spin_ functions could be commun with at least NetBSD.
@@ -193,6 +195,10 @@ s! { | |||
pub struct cpumask_t { | |||
ary: [u64; 4], | |||
} | |||
|
|||
pub struct __c_anonymous_pthread_spinlock_s { |
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.
it isn't exactly my area but I think if the OS define a struct as opaque, it should be kept opaque.
pthread_spinlock_t
is opaque in DragonflyBSD too: sys/sys/_pthreadtypes.h
libc-test/build.rs
Outdated
@@ -381,6 +381,7 @@ fn test_openbsd(target: &str) { | |||
"limits.h", | |||
"link.h", | |||
"locale.h", | |||
"machine/spinlock.h", |
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 definition shouldn't be need now that you don't use _atomic_lock_t
type.
the tests passes on OpenBSD without it.
it mess to me you reintroduced |
ah yes wrong rebasing |
rebasing still a bit wrong :
|
true. Merci beaucoup for your review ;-) |
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.
fine with me. thanks
Thanks! @bors r+ |
📌 Commit 7250a68 has been approved by |
☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13 |
No description provided.