On 03/15/2015 01:53 PM, Suliman wrote:
I have App that read config sections. If the section is true I want to
run it in new thread.
if (parseconfig.obsmpplots_load == "true")
{
auto obsmpplots = new ObsmpPlots(db);
auto theTask = task(&obsmpplots.getPlots);
theTask.executeInNewThread();
}
if(parseconfig.nadisa_load == "true")
{
auto nadisa = new Nadisa(db);
auto theTask = task(&nadisa.getPlots);
theTask.executeInNewThread();
}
It's seems work, but I do not sure that I doing it's right.
I don't see any problem. The threads start, do their jobs, and terminate.
If the threads need to produce results that they need to pass to their
owner (as messages), then std.concurrency is another option.
Ali