important:
* PIThread::~PIThread() now unregister itself from introspection, if terminates than show warning * PISystemMonitor now correctly stops * PIPeer now can correctly stopAndWait * PIPeer::destroy(), protected method for close all eths and threads * new PIINTROSPECTION_STOP macro * Introspection now can be correctly stopped by macro, more safety ClientServer: * ClientBase::close() stop and disconnect channel * Server clients clean-up now event-based * No warnings on client destructor
This commit is contained in:
@@ -568,6 +568,7 @@ PIThread::PIThread(bool startNow, PISystemTime loop_delay): PIObject() {
|
||||
PIThread::~PIThread() {
|
||||
PIINTROSPECTION_THREAD_DELETE(this);
|
||||
if (!running_ || PRIVATE->thread == 0) return;
|
||||
piCout << "[PIThread \"" << name() << "\"] Warning, terminate on destructor!";
|
||||
#ifdef FREERTOS
|
||||
// void * ret(0);
|
||||
// PICout(PICoutManipulators::DefaultControls) << "~PIThread" << PRIVATE->thread;
|
||||
@@ -587,6 +588,8 @@ PIThread::~PIThread() {
|
||||
CloseHandle(PRIVATE->thread);
|
||||
# endif
|
||||
#endif
|
||||
UNREGISTER_THREAD(this);
|
||||
PIINTROSPECTION_THREAD_STOP(this);
|
||||
terminating = running_ = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@
|
||||
//! w->startOnce();
|
||||
//!
|
||||
//! piMSleep(500);
|
||||
//! notifier.notifyOnce(); // notify one of them after 500 ms
|
||||
//! notifier.notify(); // notify one of them after 500 ms
|
||||
//! piMSleep(500);
|
||||
//! notifier.notifyOnce(); // notify one of them after 1000 ms
|
||||
//! notifier.notify(); // notify one of them after 1000 ms
|
||||
//!
|
||||
//! for (auto * w: workers)
|
||||
//! w->waitForFinish();
|
||||
@@ -93,17 +93,17 @@ PIThreadNotifier::PIThreadNotifier(): cnt(0) {}
|
||||
|
||||
//! \~\details
|
||||
//! \~english
|
||||
//! If \a notifyOnce() has been called before, then returns immediately.\n
|
||||
//! If \a notifyOnce() has been called "n" times, then returns immediately "n" times,
|
||||
//! If \a notify() has been called before, then returns immediately.\n
|
||||
//! If \a notify() has been called "n" times, then returns immediately "n" times,
|
||||
//! but only if wait in one thread.\n
|
||||
//! If many threads waiting, then if \a notifyOnce() has been called "n" times,
|
||||
//! If many threads waiting, then if \a notify() has been called "n" times,
|
||||
//! all threads total returns "n" times in undefined sequence.
|
||||
//!
|
||||
//! \~russian
|
||||
//! Если ранее был вызван \a notifyOnce(), то возвращает управление немедленно.\n
|
||||
//! Если ранее был вызван \a notifyOnce() "n" раз, то возвращает управление немедленно "n" раз,
|
||||
//! Если ранее был вызван \a notify(), то возвращает управление немедленно.\n
|
||||
//! Если ранее был вызван \a notify() "n" раз, то возвращает управление немедленно "n" раз,
|
||||
//! но только если ожидать одним потоком.\n
|
||||
//! Если ожидают несколько потоков, и \a notifyOnce() был вызван "n" раз,
|
||||
//! Если ожидают несколько потоков, и \a notify() был вызван "n" раз,
|
||||
//! то все потоки суммарно вернут управление "n" раз в неопределенной последовательности.
|
||||
//!
|
||||
void PIThreadNotifier::wait() {
|
||||
|
||||
@@ -33,8 +33,8 @@ class PIP_EXPORT PIThreadNotifier {
|
||||
public:
|
||||
PIThreadNotifier();
|
||||
|
||||
//! \~english Start waiting, return if other thread call \a notifyOnce()
|
||||
//! \~russian Начать ожидание, продолжает когда другой поток вызовет \a notifyOnce()
|
||||
//! \~english Start waiting, return if other thread call \a notify()
|
||||
//! \~russian Начать ожидание, продолжает когда другой поток вызовет \a notify()
|
||||
void wait();
|
||||
|
||||
//! \~english Notify one waiting thread, which waiting on \a wait() function
|
||||
|
||||
Reference in New Issue
Block a user