We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bc4831 commit 9dae425Copy full SHA for 9dae425
ext/or-tools/constraint.cpp
@@ -409,9 +409,12 @@ void init_constraint(Rice::Module& m) {
409
410
m.Add(NewFeasibleSolutionObserver(
411
[&callback](const CpSolverResponse& r) {
412
- // TODO find a better way to do this
413
- callback.call("response=", r);
414
- callback.call("on_solution_callback");
+ // ensure Ruby thread
+ if (ruby_native_thread_p()) {
+ // TODO find a better way to do this
415
+ callback.iv_set("@response", r);
416
+ callback.call("on_solution_callback");
417
+ }
418
})
419
);
420
}
0 commit comments