mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +01:00
Fix up some unnecessary uses of unsafe
.
This commit is contained in:
parent
da02dba979
commit
94dec69247
8 changed files with 208 additions and 226 deletions
|
@ -6,7 +6,7 @@ use std::cell::RefCell;
|
|||
use std::rc::Rc;
|
||||
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
|
||||
|
||||
static mut next_tid: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
static NEXT_TID: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
|
||||
thread_local!(static TASK_LOCAL_TID: Rc<RefCell<Option<usize>>> = Rc::new(RefCell::new(None)));
|
||||
|
||||
|
@ -15,7 +15,7 @@ pub fn tid() -> usize {
|
|||
TASK_LOCAL_TID.with(|ref k| {
|
||||
let ret =
|
||||
match *k.borrow() {
|
||||
None => unsafe { next_tid.fetch_add(1, Ordering::SeqCst) },
|
||||
None => NEXT_TID.fetch_add(1, Ordering::SeqCst),
|
||||
Some(x) => x,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue