在https://github.com/giorgiosironi/erlang-2pc/blob/master/nodes.erl#L95我產生了3個進程,在算法結束後終止(或者我認爲:他們的函數返回)。 我認爲啓動/ 0功能已經終止。爲什麼在所有這些進程到達最終狀態之後,Erlang shell都不會終止?
我開始這個功能與執行: erl -noshell -run nodes test_commit -noshell
執行功能後,我得到我的預期輸出: <0.30.0> - As coordinator added cohort: <0.31.0> <0.31.0> - Will propose: yes <0.32.0> - Will propose: yes <0.30.0> - As coordinator added cohort: <0.32.0> <0.30.0> - As coordinator, 1st phase trying to commit <0.31.0> - Queried by coordinator <0.32.0> - Queried by coordinator <0.30.0> - As coordinator received a yes <0.30.0> - As coordinator received a yes <0.30.0> - As coordinator, 2nd phase <0.31.0> - COMMIT! <0.32.0> - COMMIT! <0.30.0> - COMMIT!
但隨後的殼掛在那兒下去。我用CTRL + C退出,然後(A)退出。
爲什麼shell不會自行終止?如何在掛起狀態下檢查哪些進程仍處於活動狀態?如果這是正常的,我怎樣才能從我的測試腳本以編程方式終止它?
'init:stop()'是以乾淨的方式終止erlang的標準方式。它首先停止所有的應用程序,然後erlang系統本身。 – rvirding 2014-12-08 11:37:51