File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -411,11 +411,11 @@ impl AllUsers {
411
411
/// `passwd` entries, are called in a thread-safe manner.
412
412
///
413
413
/// These functions [modify a global
414
- /// state](http://man7.org/linux/man-pages/man3/getpwent.3.html#
415
- /// ATTRIBUTES), and if any are used at the same time, the state could
416
- /// be reset, resulting in a data race. We cannot even place it behind
417
- /// an internal `Mutex`, as there is nothing stopping another `extern`
418
- /// function definition from calling it!
414
+ /// state](http://man7.org/linux/man-pages/man3/getpwent.3.html#ATTRIBUTES),
415
+ /// and if any are used at the same time, the state could be reset,
416
+ /// resulting in a data race. We cannot even place it behind an internal
417
+ /// `Mutex`, as there is nothing stopping another `extern` function
418
+ /// definition from calling it!
419
419
///
420
420
/// So to iterate all users, construct the iterator inside an `unsafe`
421
421
/// block, then make sure to not make a new instance of it until
Original file line number Diff line number Diff line change 24
24
//! value. In this case, switching to `&mut self` would only allow for one user
25
25
//! to be read at a time!
26
26
//!
27
- //! ``norun
27
+ //! ``` norun
28
28
//! let mut cache = UsersCache::empty_cache();
29
29
//! let uid = cache.get_current_uid(); // OK...
30
30
//! let user = cache.get_user_by_uid(uid).unwrap() // OK...
43
43
//! we’re just trying the same trick as earlier. A simplified implementation of
44
44
//! a user cache lookup would look something like this:
45
45
//!
46
- //! ``norun
46
+ //! ``` norun
47
47
//! fn get_user_by_uid(&self, uid: uid_t) -> Option<&User> {
48
48
//! let users = self.users.borrow_mut();
49
49
//! users.get(uid)
You can’t perform that action at this time.
0 commit comments