1
This commit is contained in:
parent
0cda98b651
commit
56e52ca357
@ -10,7 +10,7 @@ struct BufHead
|
|||||||
namespace a8
|
namespace a8
|
||||||
{
|
{
|
||||||
|
|
||||||
FifoBuffer::FifoBuffer(unsigned int buf_len)
|
FifoBuffer::FifoBuffer(int buf_len)
|
||||||
{
|
{
|
||||||
if (buf_len <= 0) {
|
if (buf_len <= 0) {
|
||||||
abort();
|
abort();
|
||||||
@ -27,12 +27,12 @@ namespace a8
|
|||||||
buf_len_ = 0;
|
buf_len_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* FifoBuffer::Alloc(unsigned int len)
|
char* FifoBuffer::Alloc(int len)
|
||||||
{
|
{
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
unsigned int real_len = len + sizeof(BufHead);
|
int real_len = len + sizeof(BufHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FifoBuffer::Free(char* p)
|
void FifoBuffer::Free(char* p)
|
||||||
|
@ -9,19 +9,19 @@ namespace a8
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FifoBuffer(unsigned int buf_len);
|
FifoBuffer(int buf_len);
|
||||||
~FifoBuffer();
|
~FifoBuffer();
|
||||||
|
|
||||||
char* Alloc(unsigned int len);
|
char* Alloc(int len);
|
||||||
void Free(char* p);
|
void Free(char* p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
char* buf_ = nullptr;
|
char* buf_ = nullptr;
|
||||||
unsigned int buf_len_ = 0;
|
int buf_len_ = 0;
|
||||||
std::atomic<unsigned int> head_ = 0;
|
std::atomic<int> head_ = 0;
|
||||||
std::atomic<unsigned int> tail_ = 0;
|
std::atomic<int> tail_ = 0;
|
||||||
std::atomic<unsigned int> capacity_ = 0;
|
std::atomic<int> capacity_ = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user