mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2024-11-23 15:39:47 +00:00
fix ringbuffer is nullptr
Change-Id: I6164889ae67fa2c9938c8fcf6f3680b4189e15e6 Signed-off-by: leiguangyu <leiguangyu@huawei.com>
This commit is contained in:
parent
f169cfbedd
commit
ffd2a4b80e
@ -37,6 +37,9 @@ size_t RingBuffer::GetFreeSize() const
|
||||
|
||||
uint8_t *RingBuffer::AllocForWrite(size_t writeSize)
|
||||
{
|
||||
if (buf_ == nullptr || buf_.get() == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
size_t writeHead = head_.load(std::memory_order_relaxed);
|
||||
size_t readHead = tail_.load(std::memory_order_acquire);
|
||||
size_t writePos = writeHead % size_;
|
||||
|
Loading…
Reference in New Issue
Block a user