• R/O
  • SSH

Joypy: コミット

Main interpreter and library.


コミットメタ情報

リビジョンe0100f4a11e47af5d0fe72d34ce3f60f10d312cd (tree)
日時2019-08-19 03:09:36
作者Simon Forman <sforman@hush...>
コミッターSimon Forman

ログメッセージ

read child output after local thun/3

変更サマリ

差分

diff -r 37191890f191 -r e0100f4a11e4 thun/gnu-prolog/fork.pl
--- a/thun/gnu-prolog/fork.pl Sun Aug 18 10:53:25 2019 -0700
+++ b/thun/gnu-prolog/fork.pl Sun Aug 18 11:09:36 2019 -0700
@@ -1,25 +1,29 @@
11 :- multifile(func/3).
22
33 func(fork, [F, G|S], [X, Y|S]) :-
4- fork(F, S, X, ChildPID),
4+ fork(F, S, R, ChildPID),
55 thun(G, S, [Y|_]),
6+ read_pipe(R, X),
67 wait(ChildPID, Status). % FIXME check status!!!
78
8-fork(Expr, Stack, Result, ChildPID) :-
9+fork(Expr, Stack, In, ChildPID) :-
910 mkpipe(In, Out),
1011 fork_prolog(ChildPID),
11- bar(ChildPID, In, Out, Expr, Stack, Result).
12+ bar(ChildPID, In, Out, Expr, Stack).
1213
13-bar(0, In, Out, Expr, Stack, Result) :-
14+bar(0, In, Out, Expr, Stack) :-
1415 close(In),
1516 thun(Expr, Stack, [Result|_]),
1617 w(Out, Result),
1718 close(Out),
1819 halt.
1920
20-bar(P, In, Out, Expr, Stack, Result) :-
21- integer(P), P =\= 0,
22- close(Out),
21+bar(PID, _, Out, _, _) :-
22+ integer(PID),
23+ PID =\= 0,
24+ close(Out).
25+
26+read_pipe(In, Result) :-
2327 select([In], R, [], _, 1500),
2428 (R=[In] ->
2529 read(In, Result)
旧リポジトリブラウザで表示