93 lines
2.0 KiB
C++
93 lines
2.0 KiB
C++
/*
|
|
PIP - Platform Independent Primitives
|
|
Introspection module - implementation of threads
|
|
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "piintrospection_threads_p.h"
|
|
|
|
|
|
PIIntrospectionThreads::ThreadInfo::ThreadInfo() {
|
|
id = 0;
|
|
state = sStopped;
|
|
priority = 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
PIIntrospectionThreads::PIIntrospectionThreads() {
|
|
}
|
|
|
|
|
|
void PIIntrospectionThreads::threadNew(PIThread * t) {
|
|
mutex.lock();
|
|
ThreadInfo & ti(threads[t]);
|
|
ti.id = t->tid();
|
|
ti.priority = t->priority();
|
|
ti.name = t->name();
|
|
//piCout << "register thread" << id << name;
|
|
mutex.unlock();
|
|
}
|
|
|
|
|
|
void PIIntrospectionThreads::threadDelete(PIThread * t) {
|
|
mutex.lock();
|
|
threads.remove(t);
|
|
mutex.unlock();
|
|
}
|
|
|
|
|
|
void PIIntrospectionThreads::threadStart(PIThread * t) {
|
|
|
|
}
|
|
|
|
|
|
void PIIntrospectionThreads::threadRun(PIThread * t) {
|
|
|
|
}
|
|
|
|
|
|
void PIIntrospectionThreads::threadWait(PIThread * t) {
|
|
|
|
}
|
|
|
|
|
|
void PIIntrospectionThreads::threadStop(PIThread * t) {
|
|
|
|
}
|
|
|
|
|
|
void PIIntrospectionThreads::threadRunDone(PIThread * t, ullong us) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PIByteArray & operator <<(PIByteArray & b, const PIIntrospectionThreads::ThreadInfo & v) {
|
|
b << v.name << v.id << int(v.state) << v.priority;
|
|
return b;
|
|
}
|
|
|
|
|
|
PIByteArray & operator >>(PIByteArray & b, PIIntrospectionThreads::ThreadInfo & v) {
|
|
int st(0);
|
|
b >> v.id >> v.priority >> st >> v.name;
|
|
v.state = (PIIntrospectionThreads::ThreadState)st;
|
|
return b;
|
|
}
|