Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kei-q/80e88dc68a1537d611d5 to your computer and use it in GitHub Desktop.
Save kei-q/80e88dc68a1537d611d5 to your computer and use it in GitHub Desktop.
すごいErlang本の17.4のsimple_one_for_oneでterminal_childが本文と違う結果を返す件 ref: https://twitter.com/K0U_CHANG/status/645396516295733248
❯ erl
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V6.4 (abort with ^G)
1> c(band_supervisor).
{ok,band_supervisor}
2> band_supervisor:start_link(jamband).
{ok,<0.39.0>}
3> {ok, Pid} = supervisor:start_child(band_supervisor, [djembe,good]).
Musician Wanda Ann, playing the djembe entered the room
{ok,<0.41.0>}
Wanda Ann produced sound!
...
4> supervisor:terminate_child(band_supervisor, Pid).
The manager is mad and fired the whole band!Wanda Ann just got back to playing in the subway
ok
5>
❯ erl
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V6.4 (abort with ^G)
1> c(band_supervisor).
{ok,band_supervisor}
2> band_supervisor:start_link(jamband).
{ok,<0.39.0>}
3> supervisor:start_child(band_supervisor, [djembe,good]).
Musician Carlos Ann, playing the djembe entered the room
{ok,<0.41.0>}
Carlos Ann produced sound!
...
4> supervisor:terminate_child(band_supervisor, djembe).
{error,simple_one_for_one}
Carlos Ann produced sound!
5>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
^C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment