Skip to content

Commit c4eb531

Browse files
committed
---
yaml --- r: 103847 b: refs/heads/try c: 99582f8 h: refs/heads/master i: 103845: 279c033 103843: d5cd2da 103839: c5be039 v: v3
1 parent 0422208 commit c4eb531

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
5-
refs/heads/try: 24631c8bcd294c07f9c9779628ac2da761d52d6f
5+
refs/heads/try: 99582f88847b6c1feba61c4cbce7e95308d5103b
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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)