Resume execution of the given engine, and return with a status code once execution has stopped. The computation is performed by the same thread that is calling engine_resume/3.
This predicate can be used with any engine, independent of whether the engine was created with or without the 'thread' option.
For details about the returned Status, see get_engine_property/3. All status codes except 'running' are possible.
Term is an arbitrary term, a copy of which is is passed to the resumed engine. The way the resumed engine interprets Term depends on its status at resumption time:
?- engine_create(E, []), engine_resume(E, writeln(hello), S).
hello
E = $&(engine,"376oe7")
S = true
Yes (0.00s cpu)
?- engine_create(E, [thread]), engine_resume(E, writeln(hello), S).
hello
E = $&(engine,"376oe7")
S = true
Yes (0.00s cpu)
?- engine_create(E, []), engine_resume(E, 3=4, S).
E = $&(engine,"376oe7")
S = false
Yes (0.00s cpu)
?- engine_create(E, []), engine_resume(E, throw(ball), S).
E = $&(engine,"376oe7")
S = exception(ball)
Yes (0.00s cpu)
?- engine_create(E, []), engine_resume(E, throw(ball), S).
E = $&(engine,"376oe7")
S = exception(ball)
Yes (0.00s cpu)
?- engine_create(E, []),
engine_resume(E, (member(X,[a,b]),writeln(X)), S1),
writeln(first_resume->S1),
engine_resume(E, fail, S2),
writeln(second_resume->S2),
engine_resume(E, fail, S3),
writeln(third_resume->S3).
a
first_resume -> true
b
second_resume -> true
third_resume -> false