feat(Custom): handle continuous script

This commit is contained in:
Alexis
2018-09-18 23:15:37 +02:00
parent d5d620e72d
commit 00959c7d65
4 changed files with 44 additions and 5 deletions

View File

@ -13,7 +13,8 @@ class Custom : public ALabel {
Custom(const std::string, const Json::Value&);
auto update() -> void;
private:
void worker();
void delayWorker();
void continuousWorker();
const std::string name_;
waybar::util::SleeperThread thread_;

View File

@ -70,7 +70,7 @@ struct SleeperThread {
condvar_.notify_all();
}
~SleeperThread()
auto stop()
{
do_run_ = false;
condvar_.notify_all();
@ -79,6 +79,11 @@ struct SleeperThread {
}
}
~SleeperThread()
{
stop();
}
private:
std::thread thread_;
std::condition_variable condvar_;