Skip to content

Commit 4663b72

Browse files
committed
---
yaml --- r: 148869 b: refs/heads/try2 c: 99582f8 h: refs/heads/master i: 148867: a9b42f4 v: v3
1 parent c95dacf commit 4663b72

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 24631c8bcd294c07f9c9779628ac2da761d52d6f
8+
refs/heads/try2: 99582f88847b6c1feba61c4cbce7e95308d5103b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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