Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 535a954

Browse files
author
Stella Laurenzo
committed
Move some code for readability.
1 parent 34d310b commit 535a954

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

bindings/cpp/buffer.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,14 @@ void EventBuffer::FreezePrefixSlots() {
136136
}
137137

138138
uint32_t* EventBuffer::ExpandAndAddSlots(size_t count) {
139-
Chunk* new_chunk = new Chunk(chunk_limit_);
140-
new_chunk->size = count;
141-
142139
// Publish the final size of the old chunk.
143-
current_->published_size.store(current_->size,
144-
platform::memory_order_release);
140+
Flush();
145141

146142
// Publish that we have a new 'count' sized chunk.
147143
// This must come after the store to published_size as it signifies that no
148144
// further updates will be made to published_size.
145+
Chunk* new_chunk = new Chunk(chunk_limit_);
146+
new_chunk->size = count;
149147
current_->next.store(new_chunk, platform::memory_order_release);
150148

151149
// Make new chunk current (does not modify shared state).

0 commit comments

Comments
 (0)