• R/O
  • SSH

Joypy: コミット

Main interpreter and library.


コミットメタ情報

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

ログメッセージ

Rename bar to korf and some docs.

変更サマリ

差分

diff -r d21c31c27003 -r d10018cfe1ad thun/gnu-prolog/fork.pl
--- a/thun/gnu-prolog/fork.pl Sun Aug 18 12:17:37 2019 -0700
+++ b/thun/gnu-prolog/fork.pl Sun Aug 18 16:59:31 2019 -0700
@@ -1,26 +1,26 @@
11 :- multifile(func/3).
22
33 func(fork, [F, G|S], [X, Y|S]) :-
4- fork(F, S, R, ChildPID),
5- thun(G, S, [Y|_]),
6- read_pipe(R, X),
4+ fork(F, S, R, ChildPID), % Send F off to the child,
5+ thun(G, S, [Y|_]), % Run G locally,
6+ read_pipe(R, X), % Collect the result from F,
77 wait(ChildPID, Status). % FIXME check status!!!
88
99 fork(Expr, Stack, In, ChildPID) :-
1010 mkpipe(In, Out),
1111 fork_prolog(ChildPID),
12- bar(ChildPID, In, Out, Expr, Stack).
12+ korf(ChildPID, In, Out, Expr, Stack).
1313
14-bar(0, In, Out, Expr, Stack) :- close(In),
14+korf(0, In, Out, Expr, Stack) :- close(In), % In the child.
1515 thun(Expr, Stack, [Result|_]),
1616 w(Out, Result), close(Out),
1717 halt.
1818
19-bar(PID, _, Out, _, _) :-
19+korf(PID, _, Out, _, _) :- % In the parent.
2020 integer(PID), PID =\= 0,
2121 close(Out).
2222
23-read_pipe(In, Result) :-
23+read_pipe(In, Result) :- % select/5, read the pipe or timeout.
2424 select([In], R, [], _, 1500),
2525 read_pipe_(R, In, Result),
2626 close(In).
旧リポジトリブラウザで表示