Skip to content

Commit e6bd604

Browse files
committed
---
yaml --- r: 5117 b: refs/heads/master c: dabf1be h: refs/heads/master i: 5115: b255759 v: v3
1 parent c9aea11 commit e6bd604

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 30447e10919685c490aa5211bbe0dd3059bc8bb4
2+
refs/heads/master: dabf1be2267439d61029b9b9353f4ae2008a3662
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Vectors are allocated in the Rust kernel's memory region, use of
2+
// which requires some amount of synchronization. This test exercises
3+
// that synchronization by spawning a number of tasks and then
4+
// allocating and freeing vectors.
5+
6+
use std;
7+
import std::vec;
8+
import std::uint;
9+
import std::istr;
10+
import std::task;
11+
12+
fn f(n: uint) {
13+
for each i in uint::range(0u, n) {
14+
let v: [u8] = [];
15+
vec::reserve(v, 1000u);
16+
}
17+
}
18+
19+
fn main(args: [istr]) {
20+
let n = if vec::len(args) < 2u {
21+
100u
22+
} else {
23+
uint::parse_buf(istr::bytes(args[1]), 10u)
24+
};
25+
for each i in uint::range(0u, 100u) {
26+
task::spawn(bind f(n));
27+
}
28+
}

0 commit comments

Comments
 (0)