Skip to content

Commit 51c8dcc

Browse files
brsongraydon
authored andcommitted
---
yaml --- r: 1212 b: refs/heads/master c: 04056d8 h: refs/heads/master v: v3
1 parent 500aef3 commit 51c8dcc

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
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: 32c1c9f55c7a5575aa462bcec9e00cd11273841a
2+
refs/heads/master: 04056d89c831767f3c71a0cc274e7c17b5721734

trunk/src/rt/circular_buffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ circular_buffer::enqueue(void *src) {
6262
I(dom, _unread <= _buffer_sz);
6363

6464
// Grow if necessary.
65-
if (_unread == _buffer_sz) {
65+
if (_unread + unit_sz > _buffer_sz) {
6666
size_t new_buffer_sz = _buffer_sz << 1;
6767
I(dom, new_buffer_sz <= MAX_CIRCULAR_BUFFFER_SIZE);
6868
void *new_buffer = dom->malloc(new_buffer_sz);

trunk/src/test/run-pass/chan-poweroftwo.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,22 @@ impure fn test_init() {
2525
mychan <| val;
2626
}
2727

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(0u, 100u)) {
37+
mychan <| val;
38+
}
39+
}
40+
2841
impure fn main() {
2942
test_init();
43+
test_grow();
3044
}
3145

3246
// Local Variables:

0 commit comments

Comments
 (0)