run_one_thread
| 88 | // |
| 89 | // run_one_thread |
| 90 | void* run_one_thread(void* thread_info_vptr) |
| 91 | { // |
| 92 | // thread_num, f_ptr, j_begin, j_end, x_ptr, Jac_ptr |
| 93 | thread_info* thread_info_ptr = |
| 94 | static_cast<thread_info*>(thread_info_vptr); |
| 95 | size_t thread_num = thread_info_ptr->thread_num; |
| 96 | CppAD::ADFun<double>* f_ptr = thread_info_ptr->f_ptr; |
| 97 | size_t j_begin = thread_info_ptr->j_begin; |
| 98 | size_t j_end = thread_info_ptr->j_end; |
| 99 | const d_vector* x_ptr = thread_info_ptr->x_ptr; |
| 100 | d_vector* Jac_ptr = thread_info_ptr->Jac_ptr; |
| 101 | // |
| 102 | // f, Jac, ok |
| 103 | CppAD::ADFun<double>& f = *f_ptr; |
| 104 | d_vector& Jac = *Jac_ptr; |
| 105 | bool& ok = thread_info_ptr->ok; |
| 106 | // |
| 107 | // rc |
| 108 | int rc; |
| 109 | // |
| 110 | // pthread_setspecific, ok |
| 111 | // This sets up the thread_number function for this thread. |
| 112 | if( thread_num != 0 ) |
| 113 | { rc = pthread_setspecific(thread_specific_key_, &thread_num); |
| 114 | ok &= rc == 0; |
| 115 | ok &= thread_number() == thread_num; |
| 116 | } |
| 117 | // |
| 118 | // f |
| 119 | // This will cause an assert if Taylor coefficients were allocated |
| 120 | // by a different thread. |
| 121 | f.capacity_order(0); |
| 122 | // |
| 123 | // Jac |
| 124 | for(size_t j = j_begin; j < j_end; ++j) |
| 125 | Jac[j] = partial(f, j, *x_ptr); |
| 126 | // |
| 127 | return nullptr; |
| 128 | } |
| 129 | } |
| 130 | bool get_started(void) |
| 131 | { // ok |
no test coverage detected