Skip to content

Commit 991daf3

Browse files
committed
---
yaml --- r: 102623 b: refs/heads/auto c: 99582f8 h: refs/heads/master i: 102621: fd83681 102619: 9812979 102615: 3278d4e 102607: e8ff0fe 102591: fdf3c7c v: v3
1 parent 7c83539 commit 991daf3

File tree

4 files changed

+229
-336
lines changed

4 files changed

+229
-336
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 24631c8bcd294c07f9c9779628ac2da761d52d6f
16+
refs/heads/auto: 99582f88847b6c1feba61c4cbce7e95308d5103b
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libgreen/sched.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,8 @@ mod test {
14161416

14171417
#[test]
14181418
fn test_spawn_sched_blocking() {
1419-
use std::unstable::mutex::Mutex;
1419+
use std::unstable::mutex::{Mutex, MUTEX_INIT};
1420+
static mut LOCK: Mutex = MUTEX_INIT;
14201421

14211422
// Testing that a task in one scheduler can block in foreign code
14221423
// without affecting other schedulers
@@ -1425,19 +1426,15 @@ mod test {
14251426
let (start_po, start_ch) = Chan::new();
14261427
let (fin_po, fin_ch) = Chan::new();
14271428

1428-
let lock = unsafe { Mutex::new() };
1429-
let lock2 = unsafe { lock.clone() };
1430-
14311429
let mut handle = pool.spawn_sched();
14321430
handle.send(PinnedTask(pool.task(TaskOpts::new(), proc() {
1433-
let mut lock = lock2;
14341431
unsafe {
1435-
lock.lock();
1432+
LOCK.lock();
14361433

14371434
start_ch.send(());
1438-
lock.wait(); // block the scheduler thread
1439-
lock.signal(); // let them know we have the lock
1440-
lock.unlock();
1435+
LOCK.wait(); // block the scheduler thread
1436+
LOCK.signal(); // let them know we have the lock
1437+
LOCK.unlock();
14411438
}
14421439

14431440
fin_ch.send(());
@@ -1469,12 +1466,11 @@ mod test {
14691466
child_ch.send(20);
14701467
pingpong(&parent_po, &child_ch);
14711468
unsafe {
1472-
let mut lock = lock;
1473-
lock.lock();
1474-
lock.signal(); // wakeup waiting scheduler
1475-
lock.wait(); // wait for them to grab the lock
1476-
lock.unlock();
1477-
lock.destroy(); // now we're guaranteed they have no locks
1469+
LOCK.lock();
1470+
LOCK.signal(); // wakeup waiting scheduler
1471+
LOCK.wait(); // wait for them to grab the lock
1472+
LOCK.unlock();
1473+
LOCK.destroy(); // now we're guaranteed they have no locks
14781474
}
14791475
})));
14801476
drop(handle);

0 commit comments

Comments
 (0)