Re: exec/3 and waiting for processes...

From: Sebastian Sardina <ssardina_at_cs.toronto.edu>
Date: Wed 27 Nov 2002 04:33:03 PM GMT
Message-Id: <1038414787.23935.17.camel@ssardina.com.ar>
(this is a follow-up of a a somehow old message)

that's nice Joachim, thanks.
now I should add a restartable_goal/1 fact for every
predicate that performs a system call, like for instance
wait_for_input/3.

I have a program that basically waits for input with wait_for_input/3
BUT at the same time there may be after-events to do something every say
3 seconds. then wait_for_input/3 will be interrupted with error.

is this the "clean" way of solving this problem? I guess that waiting on
a set of streams is something natural for many programs...

Thanks

Sebastian

> But I agree with your general point that wait/2 should not
> abort when interrupted. You can achieve this by modifying
> the corresponding error handler as follows:
> 
> :- set_error_handler(170, my_system_error_handler/2).
> 
> my_system_error_handler(E, Goal) :-
> 	(
> 	    errno_id("Interrupted system call"),
> 	    restartable_goal(Goal)
> 	->
> 	    call(Goal)
> 	;
> 	    error(default(E), Goal)
> 	).
> 	
> restartable_goal(wait(_,_)).
> 
> 
> 
> -- 
>  Joachim Schimpf              /             phone: +44 20 7594 8187
>  IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
>  London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
> 
Received on Wed Nov 27 16:43:38 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:18 PM GMT GMT