shorter thread names

This commit is contained in:
2024-09-17 15:58:06 +03:00
parent f105f616f6
commit e186e0adff
7 changed files with 19 additions and 18 deletions

View File

@@ -763,7 +763,7 @@ void dumpApplication(bool with_objects) {
bool dumpApplicationToFile(const PIString & path, bool with_objects) { bool dumpApplicationToFile(const PIString & path, bool with_objects) {
PIFile f(path + "_tmp"); PIFile f(path + "_tmp");
f.setName("__S__DumpFile"); f.setName("_S.DumpFile");
f.clear(); f.clear();
if (!f.open(PIIODevice::WriteOnly)) return false; if (!f.open(PIIODevice::WriteOnly)) return false;
auto out_devs = PICout::currentOutputDevices(); auto out_devs = PICout::currentOutputDevices();

View File

@@ -79,7 +79,7 @@ PIBinaryLog::PIBinaryLog() {
setLogDir(PIString()); setLogDir(PIString());
setFilePrefix(PIString()); setFilePrefix(PIString());
setRapidStart(false); setRapidStart(false);
file.setName("__S__PIBinaryLog::file"); file.setName("_S.PIBinLog.file");
} }

View File

@@ -337,8 +337,8 @@ void PIIODevice::_init() {
#else #else
threaded_read_buffer_size = 4_KiB; threaded_read_buffer_size = 4_KiB;
#endif #endif
read_thread.setName("__S__.PIIODevice.read_thread"); read_thread.setName("_S.PIIODev.read");
write_thread.setName("__S__.PIIODevice.write_thread"); write_thread.setName("_S.PIIODev.write");
CONNECT(void, &write_thread, started, this, write_func); CONNECT(void, &write_thread, started, this, write_func);
CONNECTL(&read_thread, started, [this]() { CONNECTL(&read_thread, started, [this]() {
if (!isOpened()) open(); if (!isOpened()) open();
@@ -384,9 +384,10 @@ void PIIODevice::read_func() {
ok = open(); ok = open();
} }
} }
if (!ok) return; if (!ok || read_thread.isStopping()) return;
} }
ssize_t readed_ = read(buffer_tr.data(), buffer_tr.size_s()); ssize_t readed_ = read(buffer_tr.data(), buffer_tr.size_s());
if (read_thread.isStopping()) return;
if (readed_ <= 0) { if (readed_ <= 0) {
piMSleep(10); piMSleep(10);
// cout << readed_ << ", " << errno << ", " << errorString() << endl; // cout << readed_ << ", " << errno << ", " << errorString() << endl;

View File

@@ -175,7 +175,7 @@ PIPeer::PIPeer(const PIString & n)
, eth_tcp_cli(PIEthernet::TCP_Client) , eth_tcp_cli(PIEthernet::TCP_Client)
, diag_s(false) , diag_s(false)
, diag_d(false) { , diag_d(false) {
sync_timer.setName("__S__.PIPeer.sync_timer"); sync_timer.setName("_S.PIPeer.sync");
// piCout << " PIPeer" << uint(this); // piCout << " PIPeer" << uint(this);
destroyed = false; destroyed = false;
setDebug(false); setDebug(false);
@@ -229,7 +229,7 @@ void PIPeer::initEths(PIStringList al) {
piForeachC(PIString & a, al) { piForeachC(PIString & a, al) {
ce = new PIEthernet(); ce = new PIEthernet();
ce->setDebug(false); ce->setDebug(false);
ce->setName("__S__PIPeer_traffic_eth_rec_" + a); ce->setName("_S.PIPeer.traf_rec_" + a);
ce->setParameters(0); ce->setParameters(0);
bool ok = false; bool ok = false;
for (int p = _PIPEER_TRAFFIC_PORT_S; p < _PIPEER_TRAFFIC_PORT_E; ++p) { for (int p = _PIPEER_TRAFFIC_PORT_S; p < _PIPEER_TRAFFIC_PORT_E; ++p) {
@@ -249,7 +249,7 @@ void PIPeer::initEths(PIStringList al) {
if (!ok) delete ce; if (!ok) delete ce;
} }
eth_send.setDebug(false); eth_send.setDebug(false);
eth_send.setName("__S__PIPeer_traffic_eth_send"); eth_send.setName("_S.PIPeer.traf_send");
eth_send.setParameters(0); eth_send.setParameters(0);
// piCoutObj << "initEths ok"; // piCoutObj << "initEths ok";
} }
@@ -265,7 +265,7 @@ void PIPeer::initMBcasts(PIStringList al) {
// piCout << "mcast try" << a; // piCout << "mcast try" << a;
ce = new PIEthernet(); ce = new PIEthernet();
ce->setDebug(false); ce->setDebug(false);
ce->setName("__S__PIPeer_mcast_eth_" + a); ce->setName("_S.PIPeer.mcast_" + a);
ce->setParameters(0); ce->setParameters(0);
ce->setSendAddress(_PIPEER_MULTICAST_IP, _PIPEER_MULTICAST_PORT); ce->setSendAddress(_PIPEER_MULTICAST_IP, _PIPEER_MULTICAST_PORT);
ce->setReadAddress(a, _PIPEER_MULTICAST_PORT); ce->setReadAddress(a, _PIPEER_MULTICAST_PORT);
@@ -285,7 +285,7 @@ void PIPeer::initMBcasts(PIStringList al) {
piForeachC(PIString & a, al) { piForeachC(PIString & a, al) {
ce = new PIEthernet(); ce = new PIEthernet();
ce->setDebug(false); ce->setDebug(false);
ce->setName("__S__PIPeer_bcast_eth_" + a); ce->setName("_S.PIPeer.bcast_" + a);
ce->setParameters(PIEthernet::Broadcast); ce->setParameters(PIEthernet::Broadcast);
cint = prev_ifaces.getByAddress(a); cint = prev_ifaces.getByAddress(a);
nm = (cint == 0) ? "255.255.255.0" : cint->netmask; nm = (cint == 0) ? "255.255.255.0" : cint->netmask;
@@ -302,7 +302,7 @@ void PIPeer::initMBcasts(PIStringList al) {
// piCoutObj << "invalid address for bcast" << a; // piCoutObj << "invalid address for bcast" << a;
} }
} }
eth_lo.setName("__S__PIPeer_eth_loopback"); eth_lo.setName("_S.PIPeer.lo");
eth_lo.setParameters(PIEthernet::SeparateSockets); eth_lo.setParameters(PIEthernet::SeparateSockets);
eth_lo.init(); eth_lo.init();
cint = prev_ifaces.getByAddress("127.0.0.1"); cint = prev_ifaces.getByAddress("127.0.0.1");
@@ -317,13 +317,13 @@ void PIPeer::initMBcasts(PIStringList al) {
break; break;
} }
} }
eth_tcp_srv.setName("__S__PIPeer_eth_TCP_Server"); eth_tcp_srv.setName("_S.PIPeer.TCP_Server");
eth_tcp_srv.init(); eth_tcp_srv.init();
eth_tcp_srv.listen("0.0.0.0", _PIPEER_TCP_PORT, true); eth_tcp_srv.listen("0.0.0.0", _PIPEER_TCP_PORT, true);
eth_tcp_srv.setDebug(false); eth_tcp_srv.setDebug(false);
CONNECT1(void, PIEthernet *, &eth_tcp_srv, newConnection, this, newTcpClient); CONNECT1(void, PIEthernet *, &eth_tcp_srv, newConnection, this, newTcpClient);
eth_tcp_srv.startThreadedRead(); eth_tcp_srv.startThreadedRead();
eth_tcp_cli.setName("__S__PIPeer_eth_TCP_Client"); eth_tcp_cli.setName("_S.PIPeer.TCP_Client");
eth_tcp_cli.init(); eth_tcp_cli.init();
eth_tcp_cli.setDebug(false); eth_tcp_cli.setDebug(false);
tcpClientReconnect(); tcpClientReconnect();
@@ -987,7 +987,7 @@ void PIPeer::interrupt() {
void PIPeer::newTcpClient(PIEthernet * client) { void PIPeer::newTcpClient(PIEthernet * client) {
client->setName("__S__PIPeer_eth_TCP_ServerClient" + client->path()); client->setName("_S.PIPeer.TCP_ServerClient" + client->path());
piCoutObj << "client" << client->path(); piCoutObj << "client" << client->path();
CONNECT2(void, const uchar *, ssize_t, client, threadedReadEvent, this, mbcastRead); CONNECT2(void, const uchar *, ssize_t, client, threadedReadEvent, this, mbcastRead);
client->startThreadedRead(); client->startThreadedRead();

View File

@@ -998,7 +998,7 @@ PIIODevice * PIConnection::DevicePool::addDevice(PIConnection * parent, const PI
dd->started = false; dd->started = false;
} }
dd->rthread = new PIThread(dd, __DevicePool_threadReadDP); dd->rthread = new PIThread(dd, __DevicePool_threadReadDP);
dd->rthread->setName("__S__connection_" + fp + "_read_thread"); dd->rthread->setName("_S.Conn." + fp + ".read");
need_start = true; need_start = true;
pmode |= PIIODevice::ReadOnly; pmode |= PIIODevice::ReadOnly;
} }
@@ -1211,7 +1211,7 @@ PIConnection::Extractor::~Extractor() {
PIConnection::Sender::Sender(PIConnection * parent_): parent(parent_) { PIConnection::Sender::Sender(PIConnection * parent_): parent(parent_) {
setName("__S__.PIConnection.Sender"); setName("_S.PIConn.Sender");
needLockRun(true); needLockRun(true);
} }

View File

@@ -171,7 +171,7 @@ bool PITimer::waitForFinish(PISystemTime timeout) {
void PITimer::initFirst() { void PITimer::initFirst() {
thread = new PIThread([this] { threadFunc(); }); thread = new PIThread([this] { threadFunc(); });
thread->setName("__S__.PITimer.thread"); thread->setName("_S.PITimer.thread");
setProperty("interval", PISystemTime()); setProperty("interval", PISystemTime());
} }

View File

@@ -258,7 +258,7 @@ void Daemon::TileFileProgress::tileEvent(PIScreenTile * t, TileEvent e) {
Daemon::Daemon(): PIPeer(pisd_prefix + PISystemInfo::instance()->hostname + "_" + PIString::fromNumber(randomi() % 100)) { Daemon::Daemon(): PIPeer(pisd_prefix + PISystemInfo::instance()->hostname + "_" + PIString::fromNumber(randomi() % 100)) {
// setName("Daemon"); // setName("Daemon");
dtimer.setName("__S__Daemon_timer"); dtimer.setName("_S.Daemon.timer");
mode = rmNone; mode = rmNone;
offset = cur = height = 0; offset = cur = height = 0;
CONNECTU(screen, keyPressed, this, keyEvent) CONNECTU(screen, keyPressed, this, keyEvent)