Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit a26fa8dc authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Upon destruction, sigslot signals now wait for the signal_manager's signal...

Upon destruction, sigslot signals now wait for the signal_manager's signal queue to be flushed. This avoids crashed due to the signal_manager processing dangling signals, which have been deleted while being in the queue.
parent cbd7bcc6
...@@ -98,6 +98,36 @@ namespace sigslot { ...@@ -98,6 +98,36 @@ namespace sigslot {
_handlingMode = mode; _handlingMode = mode;
} }
void signal_manager::waitForSignalQueueFlushed() {
// nothing to wait for if current thread is signal_manager's thread.
if (isCurrentThreadSignalManagerThread())
return;
// nothing to wait for if the signal queue is already empty.
if (_signalQueue.empty())
return;
class SIGSLOT_API flushed_signal : public _signal_handle_base {
public:
flushed_signal(bool* ptr)
: _ptr(ptr)
{}
~flushed_signal() {}
virtual void processSignal() const {
*_ptr = true;
}
private:
bool* _ptr;
};
bool signalVariable = false;
this->queueSignalImpl(new flushed_signal(&signalVariable));
while (! signalVariable)
std::this_thread::yield(); // so we do some busy waiting here - hopefully not too long...
}
const std::string signal_manager::loggerCat_; const std::string signal_manager::loggerCat_;
......
...@@ -346,6 +346,13 @@ namespace sigslot { ...@@ -346,6 +346,13 @@ namespace sigslot {
/// \see Runnable:run /// \see Runnable:run
virtual void run(); virtual void run();
/**
* Halts the calling thread until the current signal queue has been flushed.
* Flushing means that all signals currently in the signal queue have been fully handled.
*/
void waitForSignalQueueFlushed();
private: private:
/// Private constructor only for singleton /// Private constructor only for singleton
signal_manager(); signal_manager();
...@@ -444,6 +451,11 @@ namespace sigslot { ...@@ -444,6 +451,11 @@ namespace sigslot {
class SIGSLOT_API _signal_base class SIGSLOT_API _signal_base
{ {
public: public:
~_signal_base() {
if (signal_manager::isInited())
signal_manager::getRef().waitForSignalQueueFlushed();
}
virtual void slot_disconnect(has_slots* pslot) = 0; virtual void slot_disconnect(has_slots* pslot) = 0;
virtual void slot_duplicate(has_slots const* poldslot, has_slots* pnewslot) = 0; virtual void slot_duplicate(has_slots const* poldslot, has_slots* pnewslot) = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment