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) {
PIFile f(path + "_tmp");
f.setName("__S__DumpFile");
f.setName("_S.DumpFile");
f.clear();
if (!f.open(PIIODevice::WriteOnly)) return false;
auto out_devs = PICout::currentOutputDevices();

View File

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

View File

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

View File

@@ -175,7 +175,7 @@ PIPeer::PIPeer(const PIString & n)
, eth_tcp_cli(PIEthernet::TCP_Client)
, diag_s(false)
, diag_d(false) {
sync_timer.setName("__S__.PIPeer.sync_timer");
sync_timer.setName("_S.PIPeer.sync");
// piCout << " PIPeer" << uint(this);
destroyed = false;
setDebug(false);
@@ -229,7 +229,7 @@ void PIPeer::initEths(PIStringList al) {
piForeachC(PIString & a, al) {
ce = new PIEthernet();
ce->setDebug(false);
ce->setName("__S__PIPeer_traffic_eth_rec_" + a);
ce->setName("_S.PIPeer.traf_rec_" + a);
ce->setParameters(0);
bool ok = false;
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;
}
eth_send.setDebug(false);
eth_send.setName("__S__PIPeer_traffic_eth_send");
eth_send.setName("_S.PIPeer.traf_send");
eth_send.setParameters(0);
// piCoutObj << "initEths ok";
}
@@ -265,7 +265,7 @@ void PIPeer::initMBcasts(PIStringList al) {
// piCout << "mcast try" << a;
ce = new PIEthernet();
ce->setDebug(false);
ce->setName("__S__PIPeer_mcast_eth_" + a);
ce->setName("_S.PIPeer.mcast_" + a);
ce->setParameters(0);
ce->setSendAddress(_PIPEER_MULTICAST_IP, _PIPEER_MULTICAST_PORT);
ce->setReadAddress(a, _PIPEER_MULTICAST_PORT);
@@ -285,7 +285,7 @@ void PIPeer::initMBcasts(PIStringList al) {
piForeachC(PIString & a, al) {
ce = new PIEthernet();
ce->setDebug(false);
ce->setName("__S__PIPeer_bcast_eth_" + a);
ce->setName("_S.PIPeer.bcast_" + a);
ce->setParameters(PIEthernet::Broadcast);
cint = prev_ifaces.getByAddress(a);
nm = (cint == 0) ? "255.255.255.0" : cint->netmask;
@@ -302,7 +302,7 @@ void PIPeer::initMBcasts(PIStringList al) {
// 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.init();
cint = prev_ifaces.getByAddress("127.0.0.1");
@@ -317,13 +317,13 @@ void PIPeer::initMBcasts(PIStringList al) {
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.listen("0.0.0.0", _PIPEER_TCP_PORT, true);
eth_tcp_srv.setDebug(false);
CONNECT1(void, PIEthernet *, &eth_tcp_srv, newConnection, this, newTcpClient);
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.setDebug(false);
tcpClientReconnect();
@@ -987,7 +987,7 @@ void PIPeer::interrupt() {
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();
CONNECT2(void, const uchar *, ssize_t, client, threadedReadEvent, this, mbcastRead);
client->startThreadedRead();

View File

@@ -998,7 +998,7 @@ PIIODevice * PIConnection::DevicePool::addDevice(PIConnection * parent, const PI
dd->started = false;
}
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;
pmode |= PIIODevice::ReadOnly;
}
@@ -1211,7 +1211,7 @@ PIConnection::Extractor::~Extractor() {
PIConnection::Sender::Sender(PIConnection * parent_): parent(parent_) {
setName("__S__.PIConnection.Sender");
setName("_S.PIConn.Sender");
needLockRun(true);
}

View File

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