Skip to content

Commit

Permalink
pthread_cond_t
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jul 27, 2018
1 parent 61d758b commit 3665c88
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,27 @@ s! {
size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
}

#[cfg_attr(all(feature = "align",
target_env = "musl",
target_pointer_width = "32"),
repr(align(4)))]
#[cfg_attr(all(feature = "align",
target_env = "musl",
target_pointer_width = "64"),
repr(align(8)))]
#[cfg_attr(all(feature = "align", not(target_env = "musl")),
repr(align(8)))]
pub struct pthread_cond_t {
#[cfg(any(target_env = "musl"))]
#[cfg(all(not(feature = "align"), target_env = "musl"))]
__align: [*const ::c_void; 0],
#[cfg(not(any(target_env = "musl")))]
#[cfg(not(any(feature = "align", target_env = "musl")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}

#[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_condattr_t {
#[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
}
Expand Down Expand Up @@ -796,10 +808,18 @@ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__align: [],
size: [0; __SIZEOF_PTHREAD_MUTEX_T],
};
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__align: [],
size: [0; __SIZEOF_PTHREAD_COND_T],
};
cfg_if! {
if #[cfg(feature = "align")] {
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
size: [0; __SIZEOF_PTHREAD_COND_T],
};
} else {
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__align: [],
size: [0; __SIZEOF_PTHREAD_COND_T],
};
}
}
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__align: [],
size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
Expand Down

0 comments on commit 3665c88

Please sign in to comment.