Skip to content

Commit

Permalink
Fix compilation on MacOS
Browse files Browse the repository at this point in the history
Broken by d5fb75b
  • Loading branch information
slonopotamus committed Sep 15, 2021
1 parent d5fb75b commit ef49450
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ pub struct Semaphore {

#[cfg(target_os = "linux")]
mod consts {
pub static SEM_UNDO: libc::c_short = 0x1000;
pub static SEM_UNDO: libc::c_int = 0x1000;
pub static SETVAL: libc::c_int = 16;
}

#[cfg(target_os = "macos")]
mod consts {
pub static SEM_UNDO: libc::c_short = libc::SEM_UNDO;
pub static SEM_UNDO: libc::c_int = libc::SEM_UNDO;
pub static SETVAL: libc::c_int = libc::SETVAL;
}

Expand Down Expand Up @@ -211,11 +211,7 @@ impl Semaphore {
let mut buf = sembuf {
sem_num: 0,
sem_op: amt,
sem_flg: if wait {
0
} else {
libc::IPC_NOWAIT as libc::c_short
} | SEM_UNDO,
sem_flg: (if wait { 0 } else { libc::IPC_NOWAIT } | SEM_UNDO) as libc::c_short,
};
libc::semop(self.semid, &mut buf, 1)
}
Expand Down

0 comments on commit ef49450

Please sign in to comment.