File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: b5e62b04a060dea5e51f9bb65677ea8bd23dc971
2
+ refs/heads/master: 32c1c9f55c7a5575aa462bcec9e00cd11273841a
Original file line number Diff line number Diff line change 1
1
// -*- rust -*-
2
2
3
- // Regression test for circular_buffer initialization
3
+ // Regression tests for circular_buffer when using a unit
4
+ // that has a size that is not a power of two
4
5
5
6
use std;
6
7
7
8
import std. option ;
8
9
import std. _uint ;
9
10
import std. _vec ;
10
11
11
- // 12-byte unit for the channel buffer. Assuming that the default
12
- // buffer size needs to hold 8 units, then the minimum buffer size
13
- // needs to be 96. That's not a power of two so needs to be rounded up.
12
+ // A 12-byte unit to send over the channel
14
13
type record = rec ( i32 val1 , i32 val2 , i32 val3 ) ;
15
14
16
- impure fn worker ( chan[ record] channel) {
15
+ // Assuming that the default buffer size needs to hold 8 units,
16
+ // then the minimum buffer size needs to be 96. That's not a
17
+ // power of two so needs to be rounded up. Don't trigger any
18
+ // assertions.
19
+ impure fn test_init ( ) {
20
+ let port[ record] myport = port ( ) ;
21
+ auto mychan = chan ( myport) ;
22
+
17
23
let record val = rec ( val1=0i32 , val2=0i32 , val3=0i32 ) ;
18
- channel <| val;
24
+
25
+ mychan <| val;
19
26
}
20
27
21
28
impure fn main ( ) {
22
- let port[ record] myport = port ( ) ;
23
- auto mychan = chan ( myport) ;
24
-
25
- auto temp = spawn worker ( mychan) ;
26
- auto val <- myport;
29
+ test_init ( ) ;
27
30
}
28
31
29
32
// Local Variables:
You can’t perform that action at this time.
0 commit comments