migrate to async IO model

new PIIODevice::interrupt() virtual method
new PIWaitEvent private class
PIEthernet and PISerial basically tested on Windows and Linux
This commit is contained in:
2022-11-05 23:43:07 +03:00
parent e48d0ebaab
commit 8a5e72c723
15 changed files with 498 additions and 209 deletions

View File

@@ -277,6 +277,14 @@ public:
//! \~russian Останавливает потоковое чтение и запись.
void stop();
//! \~english Stop both threaded read and threaded write and wait for finish.
//! \~russian Останавливает потоковое чтение и запись и ожидает завершения.
void stopAndWait(int timeout_ms = -1);
//! \~english Interrupt blocking operation.
//! \~russian Прерывает блокирующую операцию.
virtual void interrupt() {}
//! \~english Read from device maximum "max_size" bytes to "read_to"
//! \~russian Читает из устройства не более "max_size" байт в "read_to"
@@ -561,7 +569,7 @@ private:
PIQueue<PIPair<PIByteArray, ullong> > write_queue;
ullong tri = 0;
uint threaded_read_buffer_size, reopen_timeout = 1000;
bool reopen_enabled = true;
bool reopen_enabled = true, destroying = false;
static PIMutex nfp_mutex;
static PIMap<PIString, PIString> nfp_cache;