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

From: Sebastian Sardina <ssardina_at_cs.toronto.edu>
Date: Wed 27 Nov 2002 06:30:00 PM GMT
Message-Id: <1038421800.23935.42.camel@ssardina.com.ar>
On Wed, 2002-11-27 at 12:18, Joachim Schimpf wrote:
> Sebastian Sardina wrote:
> > 
> > (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 haven't heard of wait_for_input/3 (maybe you mean select/3),
> but I came up with the following list, which I believe covers
> everything:

yes, you are very right, in ECLIPSE it's select/3 and not
wait_for_input/3.


> 
>     % Builtins that can raise EINTR and can be restarted after that
>     restartable_builtin(accept(_,_,_)).
>     restartable_builtin(cd(_)).
>     restartable_builtin(close(_)).
>     restartable_builtin(connect(_,_)).
>     restartable_builtin(select(_,_,_)).
>     restartable_builtin(wait(_,_)).
> 
> We'll make this restart-behaviour the default in the next release.

great!


Sebastian





> > 
> > 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
> > >
> 
> -- 
>  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 18:40:46 2002

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