Skip to content

Commit 5ab6acd

Browse files
committed
fix(CSerialPort): fixed unix compile error
Signed-off-by: itas109 <itas109@qq.com>
1 parent f9a17d9 commit 5ab6acd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/SerialPortAsyncBase.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "CSerialPort/SerialPortAsyncBase.h"
22

3+
#include <sstream> // std::ostringstream for thread id
4+
35
#include "CSerialPort/ithread.hpp"
46
#include "CSerialPort/ibuffer.hpp"
57
#include "CSerialPort/itimer.hpp"
@@ -271,7 +273,9 @@ bool CSerialPortAsyncBase::startReadThread()
271273
}
272274

273275
#ifdef CSERIALPORT_DEBUG
274-
LOG_INFO("%s start read thread %s. thread id: %u", m_portName, bRet ? "success" : "failed", (*(unsigned int*)&m_readThread.get_id()));
276+
std::ostringstream oss;
277+
oss << std::this_thread::get_id();
278+
LOG_INFO("%s start read thread %s. thread id: %s", m_portName, bRet ? "success" : "failed", oss.str().c_str());
275279
#endif
276280

277281
return bRet;

0 commit comments

Comments
 (0)