我正在使用Wt(witty)C++框架,遇到了一个问题:如何阻止函数运行。如果单击按钮open\u doors\u按钮,则会激活功能doors\u open\u all,这需要很长时间才能完成。
如果用户希望停止此功能的运行,则会出现问题。
Wt::WPushButton *open_doors_button = new Wt::WPushButton("open all");
container_box->addWidget(open_doors_button);
open_doors_button->clicked().connect(boost::bind(&Servicemode::doors_open_all, this));
Wt::WPushButton *stop_doors_button = new Wt::WPushButton("stop opening");
container_box->addWidget(stop_doors_button);
stop_doors_button->clicked().connect(boost::bind(&Servicemode::stop_doors_open_all, this));