1
This commit is contained in:
parent
c7d47405ed
commit
664652a5b1
@ -154,12 +154,11 @@ void SerialPort::reconnect_loop()
|
||||
{
|
||||
if (open_port())
|
||||
{
|
||||
// 等待读线程结束
|
||||
if (reader_thread_.joinable()) reader_thread_.join();
|
||||
// 不 join reader,只等 stop_flag_
|
||||
while (running_ && !stop_flag_) std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
|
||||
close_port();
|
||||
LOG_WARN("[" + id_ + "] Port closed, will retry");
|
||||
|
||||
current_interval = retry_interval_;
|
||||
}
|
||||
else
|
||||
@ -185,8 +184,8 @@ bool SerialPort::configure_port(int fd)
|
||||
tty.c_iflag &= ~IGNBRK;
|
||||
tty.c_lflag = 0;
|
||||
tty.c_oflag = 0;
|
||||
tty.c_cc[VMIN] = 1;
|
||||
tty.c_cc[VTIME] = 1;
|
||||
tty.c_cc[VMIN] = 0;
|
||||
tty.c_cc[VTIME] = 10;
|
||||
|
||||
tty.c_iflag &= ~(IXON | IXOFF | IXANY);
|
||||
tty.c_cflag |= (CLOCAL | CREAD);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user