Hi all,
I found the solution, sorry that I bothered you. IOzSeF version 1.1 does
contain the ability to stop the search, much like the killer procedures
in Search. I just originally looked into the 1.0 sources....
My script did not work well - rarely an exception occured that was
caused by confused recomputation (much like if I just threw a
time-dependent failure inside TimeCheck). Below is a working (and clean)
version of the script.
Cheers,
Filip
LimitTime={Time.time}+MAX_SOLVE_TIME
fun {Solve Spec}
fun {SearchScript Spec KillServerPort}
proc {$ Root}
proc {TimeCheck}
if {Time.time}>LimitTime then
{Port.send KillServerPort false}
end
end
in
...
{TimeCheck}
...
end
end
SearchResult
SearchOK
in
SearchResult=
thread
R %% Search result
KillServerPortStream
KillServerPort={NewPort KillServerPortStream}
in
%% Killer server
thread
case KillServerPortStream
of Val|_ then
SearchOK=Val
if Val==false then
{IOzSeF.cancelSearch}
end
end
end
R=thread
T={Thread.this}
{IOzSeF.searchOne
{SearchScript Spec KillServerPort}}
end
{Wait R}
{Port.send KillServerPort true}
R
end
if {Not SearchOK} then SearchResult=nil end
case SearchResult
of Solution|_ then
...
else
...
end
end
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users