void CTrajDlg::OnBnClickedView() { int sel = m_vars_c.GetCurSel(); if (sel < 0) return; CGraphsDlg dlg; if (sel < core().link_count() - 1) { MVar var = core().var_by_number(sel); dlg.func = &core().traj_record().spline(var); if (dlg.func->empty()) { MessageBox("Эта координата не влияет на положение манипулятора", "Внимание!"); return; } dlg.x_units = "сек"; dlg.y_units = core().link_det_unit(sel).c_str(); dlg.caption = CString("Траектория обобщенной координаты ") + var.GetName().c_str() + "."; } else { int c = sel - (core().link_count() - 1); String xyz[] = {"x", "y", "z"}; String var1 = xyz[c] + "t"; String var2 = xyz[c] + "r"; dlg.func = &core().traj_record().spline(var2.c_str()); dlg.func_2 = &core().traj_record().spline(var1.c_str()); dlg.x_units = "сек"; dlg.y_units = "м"; dlg.caption = CString("Траектория координаты (") + xyz[c].c_str() + ") схвата в ССК. (Красная - теоретическая)."; } dlg.DoModal(); }
void subthread(){ for(int i=0; i < iterations; i++){ int val = target.take(); #if BOOST_VERSION >= 103500 //increase chances of catching failure boost::this_thread::yield(); #endif target.put(val+1); } }
void loop() { while (true) { Task task = _task.take(); if (task.empty()) { break; // ends the thread } try { task(); } catch (std::exception e) { log() << "Unhandled exception in worker thread: " << e.what() << endl;; } catch (...) { log() << "Unhandled non-exception in worker thread" << endl; } _is_done = true; _owner.task_done(this); } }
void distributor::getDouble(MVar &var, double &d) { numReal nr; if (var.getNumReal(&nr)) { d=nr.get(); } else validC->setErr(NOTREAL); }
void loop(const std::string& threadName) { setThreadName(threadName); while (true) { Task task = _task.take(); if (!task) break; // ends the thread try { task(); } catch (DBException& e) { log() << "Unhandled DBException: " << e.toString(); } catch (std::exception& e) { log() << "Unhandled std::exception in worker thread: " << e.what(); } catch (...) { log() << "Unhandled non-exception in worker thread"; } _is_done = true; _owner.task_done(this); } }
void validate(){ ASSERT_EQUALS(target.take() , nthreads * iterations); }