Skip to content

Commit

Permalink
unistd: Mark fork() and related methods as #[inline]
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalmarhubi committed Mar 30, 2016
1 parent c2acb9e commit c2f8bb7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ pub enum ForkResult {
}

impl ForkResult {
#[inline]
pub fn is_child(&self) -> bool {
match *self {
ForkResult::Child => true,
_ => false
}
}

#[inline]
pub fn is_parent(&self) -> bool {
!self.is_child()
}
}

#[inline]
pub fn fork() -> Result<ForkResult> {
use self::ForkResult::*;
let res = unsafe { libc::fork() };
Expand Down

0 comments on commit c2f8bb7

Please sign in to comment.