]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #25585 - sferik:change-default-gender, r=steveklabnik
authorSteve Klabnik <steve@steveklabnik.com>
Tue, 19 May 2015 22:38:53 +0000 (18:38 -0400)
committerSteve Klabnik <steve@steveklabnik.com>
Tue, 19 May 2015 22:38:53 +0000 (18:38 -0400)
The paper from which this example was taken made the mistake of assuming that all five philosophers are men. This it is a hypothetical example—there are no actual philosophers eating :spaghetti:—so there is no good reason to make this assumption. Since women make up about half of the human population, all things being equal, women should represent about half of the philosophers. However, because this mistake has stood since 1985, I have changed *all* of the pronouns to be female, to make up for lost time. If someone would like to revert this patch or switch to neutral pronouns after 30 years, feel free to set your alarm clock for 2045.

r? @steveklabnik, since this is a documentation change and was created after reading http://words.steveklabnik.com/ouroboros, where I noticed this mistake.

src/libcore/num/mod.rs
src/libstd/process.rs
src/libstd/sys/unix/process.rs
src/libstd/sys/windows/c.rs
src/libstd/sys/windows/process.rs

index bd7286dfa3fa5cd09dd168a974c5b71eeae71f38..91faba7376bcafcac8ae539790a5a675275433b0 100644 (file)
@@ -132,15 +132,11 @@ pub fn max_value() -> $T {
         ///
         /// Leading and trailing whitespace represent an error.
         ///
-        /// # Arguments
-        ///
-        /// * src - A string slice
-        /// * radix - The base to use. Must lie in the range [2 .. 36]
-        ///
-        /// # Return value
+        /// # Examples
         ///
-        /// `Err(ParseIntError)` if the string did not represent a valid number.
-        /// Otherwise, `Ok(n)` where `n` is the integer represented by `src`.
+        /// ```
+        /// assert_eq!(u32::from_str_radix("A", 16), Some(10));
+        /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
         #[allow(deprecated)]
         pub fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseIntError> {
index 61398e16ba03613e4063433b155e1fb97d41a081..ae9316ddd622b1d3a6fb90a1623cefd89fc49a35 100644 (file)
@@ -456,6 +456,12 @@ pub fn kill(&mut self) -> io::Result<()> {
         unsafe { self.handle.kill() }
     }
 
+    /// Returns the OS-assigned process identifier associated with this child.
+    #[unstable(feature = "process_id", reason = "api recently added")]
+    pub fn id(&self) -> u32 {
+        self.handle.id()
+    }
+
     /// Waits for the child to exit completely, returning the status that it
     /// exited with. This function will continue to have the same return value
     /// after it has been called at least once.
index 290310f4ad90181738f44866979318ad32ee3bdb..f4bc597304097c85b91ca0d17a807e042da92391 100644 (file)
@@ -315,6 +315,10 @@ fn fail(output: &mut AnonPipe) -> ! {
         fail(&mut output)
     }
 
+    pub fn id(&self) -> u32 {
+        self.pid as u32
+    }
+
     pub fn wait(&self) -> io::Result<ExitStatus> {
         let mut status = 0 as c_int;
         try!(cvt_r(|| unsafe { c::waitpid(self.pid, &mut status, 0) }));
index b07d063de45c992630cd76c61459b1c08ac7823e..e9b850856e1f86c79b4af6d139c833bb6aa2d913 100644 (file)
@@ -482,6 +482,7 @@ pub fn WaitForSingleObject(hHandle: libc::HANDLE,
                                dwMilliseconds: libc::DWORD) -> libc::DWORD;
     pub fn SwitchToThread() -> libc::BOOL;
     pub fn Sleep(dwMilliseconds: libc::DWORD);
+    pub fn GetProcessId(handle: libc::HANDLE) -> libc::DWORD;
 }
 
 #[link(name = "userenv")]
index 032a349b00eff11e211f6a6a6da2e7f3766d3003..bc4762c197e1429eb3fa60133a5ade26bdcd84ba 100644 (file)
@@ -193,6 +193,12 @@ pub unsafe fn kill(&self) -> io::Result<()> {
         Ok(())
     }
 
+    pub fn id(&self) -> u32 {
+        unsafe {
+            c::GetProcessId(self.handle.raw()) as u32
+        }
+    }
+
     pub fn wait(&self) -> io::Result<ExitStatus> {
         use libc::{STILL_ACTIVE, INFINITE, WAIT_OBJECT_0};
         use libc::{GetExitCodeProcess, WaitForSingleObject};