Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ring_buf #79

Open
NanoPangBZ opened this issue Dec 13, 2023 · 1 comment
Open

ring_buf #79

NanoPangBZ opened this issue Dec 13, 2023 · 1 comment
Labels

Comments

@NanoPangBZ
Copy link

NanoPangBZ commented Dec 13, 2023

描述bug
当read的数量大于ring_buf当前的数值是会有bug

重现步骤

//初始化
port1 = new CSerialPort;
port1->init( "COM2" , 256000 );
port1->setOperateMode(AsynchronousOperate);
port1->setReadBufferSize(1024);
port1->setReadIntervalTimeout(0);
port1->open();

//自己的额外的接收线程
static void* port1_across_impl(void* args)
{
uint8_t buf[1024];
int read_cnt;
int write_cnt;
int writed_cnt;
while(1)
{
read_cnt = port1->readData( buf , 12 );
if( read_cnt != 0 )
{
std::cout<<read_cnt<<std::endl;
}
}
pthread_exit(NULL);
}

//外围设备向port1发送"12341241234132421342314\r\n"之后便没有后续发送了,但是readData函数仍然返回12,断点查看 ibuffer.hpp中的read方法发现m_head一直在增长

运行环境信息:

  • 操作系统: win 11
  • 编译器:x86_64-w64-mingw32
@itas109 itas109 added the bug label Dec 24, 2023
@itas109
Copy link
Owner

itas109 commented Dec 24, 2023

感谢反馈
建议加Q群129518033沟通,这样效率更高

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants