HPCC-10313 Stop Ws_fs/WsWorkunits Schedule thread correctly Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
@@ -48,7 +48,7 @@ int Schedule::run()
{
try
- while(true)
+ while(!stopping)
Owned<IDFUWorkUnitFactory> factory = getDFUWorkUnitFactory();
@@ -78,7 +78,7 @@ int Schedule::run()
itr->next();
}
- sleep(60);
+ semSchedule.wait(1000*60);
catch(IException *e)
@@ -91,7 +91,6 @@ int Schedule::run()
ERRLOG("Unknown exception in WS_FS Schedule::run");
-
return 0;
@@ -25,8 +25,21 @@
class Schedule : public Thread
+ bool stopping;
+ Semaphore semSchedule;
IEspContainer* m_container;
public:
+ Schedule()
+ {
+ stopping = false;
+ };
+ ~Schedule()
+ stopping = true;
+ semSchedule.signal();
+ join();
+ }
+
virtual int run();
virtual void setContainer(IEspContainer * container)
@@ -2617,7 +2617,7 @@ int WUSchedule::run()
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
Owned<IConstWorkUnitIterator> itr = factory->getWorkUnitsByState(WUStateScheduled);
@@ -2652,7 +2652,7 @@ int WUSchedule::run()
@@ -317,9 +317,22 @@ void xsltTransform(const char* xml, const char* sheet, IProperties *params, Stri
class WUSchedule : public Thread
+ WUSchedule()
+ ~WUSchedule()