Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.

This commit is contained in:
Ms2ger 2015-01-02 12:45:28 +01:00 committed by Josh Matthews
parent cf616b90a2
commit 16c7060bc8
153 changed files with 2095 additions and 1298 deletions

View file

@ -3,20 +3,24 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::sync::atomic::{AtomicUint, INIT_ATOMIC_UINT, SeqCst};
use std::rc::Rc;
use std::cell::RefCell;
static mut next_tid: AtomicUint = INIT_ATOMIC_UINT;
local_data_key!(task_local_tid: uint)
thread_local!(static task_local_tid: Rc<RefCell<Option<uint>>> = Rc::new(RefCell::new(None)))
/// Every task gets one, that's unique.
pub fn tid() -> uint {
let ret =
match task_local_tid.replace(None) {
None => unsafe { next_tid.fetch_add(1, SeqCst) },
Some(x) => x,
};
task_local_tid.with(|ref k| {
let ret =
match *k.borrow() {
None => unsafe { next_tid.fetch_add(1, SeqCst) },
Some(x) => x,
};
task_local_tid.replace(Some(ret));
*k.borrow_mut() = Some(ret);
ret
ret
})
}