Problem with std::future

Dear all:

I am trying to run concurrently a function that contains a TF1 I use to fit a simple graph. I create a vector of futures for each object I want to analyze:

//Estimaton of track parameters
        std::vector<std::future<void>> futures;
        futures.reserve(10);

        for(auto& track : tracks)
        {

            futures.push_back( std::async(std::launch::async,&ATPRA::SetTrackInitialParameters,this,std::ref(track)) );

        }

        for(auto& future : futures) future.wait();

The SetTrackInitialParameters contains a very simple TF1:

TF1 *f1 = new TF1("f1","pol1",-500,500);

The code compiles but I get this run-time error:

input_line_32:1:9: error: unknown type name ''
Double_t TFormula____id76870135910997656(Double_t *x,Double_t *p){ return p[0]+p[1]*x[0] ; }

I’ve tried different ways but the result is always the same.

Thank you in advance
Y.


ROOT Version: 6.10/08
Platform: Ubuntu 16
Compiler: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609


Hi,
I think you cannot JIT in multi-threads automatically. You might need to activate the locks by calling before
ROOT::EnableThreadSafety()

Lorenzo

Hi Lorenzo

That worked like a charm. Thank you!

Y.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.