File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 30447e10919685c490aa5211bbe0dd3059bc8bb4
2
+ refs/heads/master: dabf1be2267439d61029b9b9353f4ae2008a3662
Original file line number Diff line number Diff line change
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 ( 0 u, n) {
14
+ let v: [ u8 ] = [ ] ;
15
+ vec:: reserve ( v, 1000 u) ;
16
+ }
17
+ }
18
+
19
+ fn main ( args : [ istr ] ) {
20
+ let n = if vec:: len ( args) < 2 u {
21
+ 100 u
22
+ } else {
23
+ uint:: parse_buf ( istr:: bytes ( args[ 1 ] ) , 10 u)
24
+ } ;
25
+ for each i in uint:: range ( 0 u, 100 u) {
26
+ task:: spawn ( bind f( n) ) ;
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments