| Prev | Next |  |  |  |  |  | multi_atomic_worker |

Multi-Threaded User Atomic Worker
Purpose
This routine does the computation for one thread.
Source

    namespace {
    void multi_atomic_worker(void)
    {     size_t thread_num  = thread_alloc::thread_num();
         size_t num_threads = std::max(num_threads_, size_t(1));
         bool   ok          = thread_num < num_threads;
         //
         vector<double> x(1), y(1);
         size_t n = work_all_[thread_num]->y_squared->size();
         work_all_[thread_num]->square_root->resize(n);
         for(size_t i = 0; i < n; i++)
         {     x[0] = (* work_all_[thread_num]->y_squared )[i];
              y    = work_all_[thread_num]->fun->Forward(0, x);
              //
              (* work_all_[thread_num]->square_root )[i] = y[0];
         }
         work_all_[thread_num]->ok             = ok;
    }
    }

Input File: example/multi_thread/multi_atomic.cpp