more literals, use some in PIP, small refactor PIThread::start (clang-format mistakes)

This commit is contained in:
2023-07-02 14:02:10 +03:00
parent 54d0ba1876
commit ccae1a7311
15 changed files with 530 additions and 294 deletions

View File

@@ -21,6 +21,7 @@
#include "piconfig.h"
#include "piconstchars.h"
#include "piincludes_p.h"
#include "piliterals.h"
#include "pipropertystorage.h"
#include "pisysteminfo.h"
// clang-format off
@@ -167,11 +168,11 @@ void PIEthernet::construct() {
setTTL(64);
setMulticastTTL(1);
server_thread_.setData(this);
server_thread_.setName("__S__server_thread");
server_thread_.setName("__S__server_thread"_a);
#ifdef MICRO_PIP
setThreadedReadBufferSize(512);
#else
setThreadedReadBufferSize(65536);
setThreadedReadBufferSize(64_KiB);
#endif
// setPriority(piHigh);
}
@@ -305,7 +306,7 @@ bool PIEthernet::closeDevice() {
server_thread_.stop();
PRIVATE->event.interrupt();
if (server_thread_.isRunning()) {
if (!server_thread_.waitForFinish(1000)) server_thread_.terminate();
if (!server_thread_.waitForFinish(1_s)) server_thread_.terminate();
}
PRIVATE->event.destroy();
if (sock_s == sock) sock_s = -1;
@@ -487,7 +488,7 @@ bool PIEthernet::listen(bool threaded) {
if (server_thread_.isRunning()) {
if (!server_bounded) return true;
server_thread_.stop();
if (!server_thread_.waitForFinish(100)) server_thread_.terminate();
if (!server_thread_.waitForFinish(100_ms)) server_thread_.terminate();
}
listen_threaded = true;
server_bounded = false;