File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 32c1c9f55c7a5575aa462bcec9e00cd11273841a
2
+ refs/heads/master: 04056d89c831767f3c71a0cc274e7c17b5721734
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ circular_buffer::enqueue(void *src) {
62
62
I (dom, _unread <= _buffer_sz);
63
63
64
64
// Grow if necessary.
65
- if (_unread == _buffer_sz) {
65
+ if (_unread + unit_sz > _buffer_sz) {
66
66
size_t new_buffer_sz = _buffer_sz << 1 ;
67
67
I (dom, new_buffer_sz <= MAX_CIRCULAR_BUFFFER_SIZE);
68
68
void *new_buffer = dom->malloc (new_buffer_sz);
Original file line number Diff line number Diff line change @@ -25,8 +25,22 @@ impure fn test_init() {
25
25
mychan <| val;
26
26
}
27
27
28
+ // Dump lots of items into the channel so it has to grow.
29
+ // Don't trigger any assertions.
30
+ impure fn test_grow ( ) {
31
+ let port[ record] myport = port ( ) ;
32
+ auto mychan = chan ( myport) ;
33
+
34
+ let record val = rec ( val1=0i32 , val2=0i32 , val3=0i32 ) ;
35
+
36
+ for each ( uint i in _uint. range( 0 u, 100 u) ) {
37
+ mychan <| val;
38
+ }
39
+ }
40
+
28
41
impure fn main ( ) {
29
42
test_init ( ) ;
43
+ test_grow ( ) ;
30
44
}
31
45
32
46
// Local Variables:
You can’t perform that action at this time.
0 commit comments