remove some unused defines
This commit is contained in:
@@ -19,13 +19,13 @@
|
||||
|
||||
#include "piobject.h"
|
||||
|
||||
#include "piconditionvar.h"
|
||||
#include "pithread.h"
|
||||
#include "pitime.h"
|
||||
#ifdef PIP_HAS_THREADS
|
||||
# include "piconditionvar.h"
|
||||
# include "pifile.h"
|
||||
# include "piiostream.h"
|
||||
# include "pisysteminfo.h"
|
||||
# include "pithread.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -176,13 +176,9 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
|
||||
in_event_cnt = 0;
|
||||
setName(name);
|
||||
setDebug(true);
|
||||
#ifdef PIP_HAS_THREADS
|
||||
mutexObjects().lock();
|
||||
#endif
|
||||
objects() << this;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
mutexObjects().unlock();
|
||||
#endif
|
||||
// piCout << "new" << this;
|
||||
}
|
||||
|
||||
@@ -190,13 +186,9 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
|
||||
PIObject::~PIObject() {
|
||||
in_event_cnt = 0;
|
||||
// piCout << "delete" << this;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
mutexObjects().lock();
|
||||
#endif
|
||||
objects().removeAll(this);
|
||||
#ifdef PIP_HAS_THREADS
|
||||
mutexObjects().unlock();
|
||||
#endif
|
||||
deleted(this);
|
||||
piDisconnectAll();
|
||||
_signature_ = 0;
|
||||
@@ -555,7 +547,6 @@ PIMap<uint, PIObject::__MetaData> & PIObject::__meta_data() {
|
||||
}
|
||||
|
||||
|
||||
#ifdef PIP_HAS_THREADS
|
||||
void PIObject::callQueuedEvents() {
|
||||
mutex_queue.lock();
|
||||
PIVector<__QueuedEvent> qe = events_queue;
|
||||
@@ -569,7 +560,6 @@ void PIObject::callQueuedEvents() {
|
||||
if (e.dest_o->thread_safe_) e.dest_o->mutex_.unlock();
|
||||
}
|
||||
}
|
||||
#endif // PIP_HAS_THREADS
|
||||
|
||||
|
||||
//! \details
|
||||
@@ -734,8 +724,7 @@ void PIObject::dump(const PIString & line_prefix) const {
|
||||
PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " << dst->className() << " (" << c.dest
|
||||
<< ", \"" << dst->name() << "\")::" << hf_fn;
|
||||
} else {
|
||||
PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> "
|
||||
<< "[lambda]";
|
||||
PICout(PICoutManipulators::AddNewLine) << line_prefix << " " << src << " -> " << "[lambda]";
|
||||
}
|
||||
}
|
||||
// printf("dump %d connections ok\n",connections.size());
|
||||
|
||||
@@ -461,9 +461,7 @@ public:
|
||||
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender));
|
||||
} else {
|
||||
bool ts = sender->thread_safe_;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.lock();
|
||||
#endif
|
||||
i.dest_o->eventBegin();
|
||||
sender->eventBegin();
|
||||
i.dest_o->emitter_ = sender;
|
||||
@@ -471,9 +469,7 @@ public:
|
||||
sender->eventEnd();
|
||||
if (i.dest_o->isPIObject()) {
|
||||
i.dest_o->emitter_ = 0;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.unlock();
|
||||
#endif
|
||||
i.dest_o->eventEnd();
|
||||
}
|
||||
}
|
||||
@@ -498,9 +494,7 @@ public:
|
||||
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
|
||||
} else {
|
||||
bool ts = sender->thread_safe_;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.lock();
|
||||
#endif
|
||||
i.dest_o->eventBegin();
|
||||
sender->eventBegin();
|
||||
i.dest_o->emitter_ = sender;
|
||||
@@ -511,9 +505,7 @@ public:
|
||||
sender->eventEnd();
|
||||
if (i.dest_o->isPIObject()) {
|
||||
i.dest_o->emitter_ = 0;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.unlock();
|
||||
#endif
|
||||
i.dest_o->eventEnd();
|
||||
}
|
||||
}
|
||||
@@ -538,9 +530,7 @@ public:
|
||||
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
|
||||
} else {
|
||||
bool ts = sender->thread_safe_;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.lock();
|
||||
#endif
|
||||
i.dest_o->eventBegin();
|
||||
sender->eventBegin();
|
||||
i.dest_o->emitter_ = sender;
|
||||
@@ -552,9 +542,7 @@ public:
|
||||
sender->eventEnd();
|
||||
if (i.dest_o->isPIObject()) {
|
||||
i.dest_o->emitter_ = 0;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.unlock();
|
||||
#endif
|
||||
i.dest_o->eventEnd();
|
||||
}
|
||||
}
|
||||
@@ -580,9 +568,7 @@ public:
|
||||
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
|
||||
} else {
|
||||
bool ts = sender->thread_safe_;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.lock();
|
||||
#endif
|
||||
i.dest_o->eventBegin();
|
||||
sender->eventBegin();
|
||||
i.dest_o->emitter_ = sender;
|
||||
@@ -595,9 +581,7 @@ public:
|
||||
sender->eventEnd();
|
||||
if (i.dest_o->isPIObject()) {
|
||||
i.dest_o->emitter_ = 0;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.unlock();
|
||||
#endif
|
||||
i.dest_o->eventEnd();
|
||||
}
|
||||
}
|
||||
@@ -629,9 +613,7 @@ public:
|
||||
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
|
||||
} else {
|
||||
bool ts = sender->thread_safe_;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.lock();
|
||||
#endif
|
||||
i.dest_o->eventBegin();
|
||||
sender->eventBegin();
|
||||
i.dest_o->emitter_ = sender;
|
||||
@@ -645,9 +627,7 @@ public:
|
||||
sender->eventEnd();
|
||||
if (i.dest_o->isPIObject()) {
|
||||
i.dest_o->emitter_ = 0;
|
||||
#ifdef PIP_HAS_THREADS
|
||||
if (ts) i.dest_o->mutex_.unlock();
|
||||
#endif
|
||||
i.dest_o->eventEnd();
|
||||
}
|
||||
}
|
||||
@@ -658,7 +638,6 @@ public:
|
||||
|
||||
//! \~english Returns the first live object with name "name", or \c nullptr.
|
||||
//! \~russian Возвращает первый живой объект с именем "name", либо \c nullptr.
|
||||
#ifdef PIP_HAS_THREADS
|
||||
static PIObject * findByName(const PIString & name) {
|
||||
PIMutexLocker _ml(mutexObjects());
|
||||
for (auto * i: PIObject::objects()) {
|
||||
@@ -667,7 +646,6 @@ public:
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
//! \~english Returns whether this pointer still refers to a live %PIObject instance.
|
||||
//! \~russian Возвращает, указывает ли этот указатель на ещё существующий экземпляр %PIObject.
|
||||
@@ -675,7 +653,6 @@ public:
|
||||
|
||||
//! \~english Returns whether this object belongs to class "T" or one of its registered descendants.
|
||||
//! \~russian Возвращает, принадлежит ли этот объект классу "T" или одному из его зарегистрированных потомков.
|
||||
#ifdef PIP_HAS_THREADS
|
||||
template<typename T>
|
||||
bool isTypeOf() const {
|
||||
if (!isPIObject()) return false;
|
||||
@@ -690,7 +667,6 @@ public:
|
||||
if (!isTypeOf<T>()) return (T *)nullptr;
|
||||
return (T *)this;
|
||||
}
|
||||
#endif
|
||||
|
||||
//! \~english Returns whether "o" points to a live %PIObject instance.
|
||||
//! \~russian Возвращает, указывает ли "o" на ещё существующий экземпляр %PIObject.
|
||||
@@ -859,13 +835,8 @@ private:
|
||||
PIObject * emitter_;
|
||||
std::atomic_int in_event_cnt;
|
||||
|
||||
#ifdef PIP_HAS_THREADS
|
||||
PIMutex mutex_, mutex_connect, mutex_queue;
|
||||
bool thread_safe_, proc_event_queue;
|
||||
#else
|
||||
PIMutex mutex_, mutex_connect, mutex_queue;
|
||||
bool thread_safe_ = false, proc_event_queue = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef PIP_HAS_THREADS
|
||||
|
||||
Reference in New Issue
Block a user