1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 19:54:57 +08:00

implement SerialImpl::waitByteTimes on windows

This commit is contained in:
X.F.Zhou 2022-07-18 21:53:55 +08:00
parent 69e0372cf0
commit 7ca1d440fa

View File

@ -322,9 +322,13 @@ Serial::SerialImpl::waitReadable (uint32_t /*timeout*/)
} }
void void
Serial::SerialImpl::waitByteTimes (size_t /*count*/) Serial::SerialImpl::waitByteTimes (size_t count)
{ {
THROW (IOException, "waitByteTimes is not implemented on Windows."); DWORD wait_time = timeout_.inter_byte_timeout * count;
HANDLE wait_event = CreateEvent(NULL, FALSE, FALSE, NULL);
ResetEvent(wait_event);
WaitForSingleObject(wait_event, wait_time);
CloseHandle(wait_event);
} }
size_t size_t