minor cleanup

This commit is contained in:
Simon Forman
2019-08-20 22:00:27 -07:00
parent 6e646c012f
commit 558f45bf47
5 changed files with 32 additions and 11 deletions
+22
View File
@@ -1,9 +1,31 @@
/*
Copyright 2019 Simon Forman
This file is part of Thun
Thun is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Thun is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Thun. If not see <http://www.gnu.org/licenses/>.
A fork function that actually forks. Experimental.
*/
:- multifile(func/3).
func(fork, [F, G|S], [X, Y|S]) :-
fork(F, S, R, ChildPID), % Send F off to the child,
thun(G, S, [Y|_]), % Run G locally,
read_pipe(R, X), % Collect the result from F,
% FIXME deal with X=timeout...
wait(ChildPID, Status). % FIXME check status!!!
fork(Expr, Stack, In, ChildPID) :-