aboutsummaryrefslogtreecommitdiffstats
path: root/src/mysqlerl_port_sup.erl
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2008-03-02 15:40:17 -0500
committerBrian Cully <github.20.shmit@spamgourmet.com>2008-03-02 15:40:17 -0500
commit04f18c9d501b444d3bde4d38fd674df8c3a2db3d (patch)
treeb81c487d53e9fba3d57795b9f37008da791123b8 /src/mysqlerl_port_sup.erl
parent9778362e464451f1be6943d2d37a47b4afbcb091 (diff)
downloadmysqlerl-04f18c9d501b444d3bde4d38fd674df8c3a2db3d.tar.gz
mysqlerl-04f18c9d501b444d3bde4d38fd674df8c3a2db3d.zip
Change supervision heirarchy to allow ports to support:
1) Owner process dies - shut down connection cleanly. 2) Port driver dies - restart port driver
Diffstat (limited to 'src/mysqlerl_port_sup.erl')
-rw-r--r--src/mysqlerl_port_sup.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mysqlerl_port_sup.erl b/src/mysqlerl_port_sup.erl
new file mode 100644
index 0000000..820f929
--- /dev/null
+++ b/src/mysqlerl_port_sup.erl
@@ -0,0 +1,16 @@
+-module(mysqlerl_port_sup).
+-author('bjc@kublai.com').
+
+-behavior(supervisor).
+
+-export([start_link/1]).
+-export([init/1]).
+
+start_link(Cmd) ->
+ supervisor:start_link(?MODULE, [Cmd]).
+
+init([Cmd]) ->
+ Port = {mysqlerl_port, {mysqlerl_port, start_link, [Cmd]},
+ transient, 5, worker, [mysqlerl_port]},
+ {ok, {{one_for_one, 10, 5},
+ [Port]}}.