aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Lasseter <Nathan Lasseter nathan@bytemark.co.uk>2014-05-30 13:34:17 +0100
committerNathan Lasseter <Nathan Lasseter nathan@bytemark.co.uk>2014-05-30 13:34:17 +0100
commit08fecb93995728ab53d78beefc329331d79f303f (patch)
tree3ba80e9dede138ce108ad53183cecc47069c736e
parent59cee25c7f863e76bc82cd58b33f6f3b4e13770c (diff)
Added directory structure and Makefile
-rw-r--r--.gitignore1
-rw-r--r--Makefile19
-rw-r--r--eco_watcher.erl12
-rw-r--r--src/eco_pool.erl (renamed from eco_pool.erl)0
-rw-r--r--src/eco_proc.erl (renamed from eco_proc.erl)0
-rw-r--r--src/eco_tb.erl (renamed from eco_tb.erl)8
-rw-r--r--src/eco_time.erl (renamed from eco_time.erl)0
-rw-r--r--src/eco_watcher.erl16
8 files changed, 42 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index 17278c0..002acbd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
*.beam
+erl_crash.dump
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2dfb4cc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+MODULES=eco_pool eco_proc eco_time eco_watcher eco_tb
+
+PREREQS=$(addprefix bin/, $(addsuffix .beam, ${MODULES}))
+
+.PHONY: all run clean
+
+all: bin/ ${PREREQS}
+
+run: bin/ ${PREREQS}
+ erl -pz bin/ -noshell -run eco_tb start
+
+clean:
+ rm -r bin erl_crash.dump
+
+bin/:
+ mkdir bin
+
+bin/%.beam: src/%.erl
+ erlc -o bin/ $<
diff --git a/eco_watcher.erl b/eco_watcher.erl
deleted file mode 100644
index f2b6e25..0000000
--- a/eco_watcher.erl
+++ /dev/null
@@ -1,12 +0,0 @@
--module(eco_watcher).
--export([watcher/0]).
-
-watcher() ->
- receive
- {From, stop} ->
- From ! {ok, stopped},
- {ok, stopped};
- Msg ->
- io:format("~p~n", [Msg]),
- watcher()
- end.
diff --git a/eco_pool.erl b/src/eco_pool.erl
index 63fbc3d..63fbc3d 100644
--- a/eco_pool.erl
+++ b/src/eco_pool.erl
diff --git a/eco_proc.erl b/src/eco_proc.erl
index c179a26..c179a26 100644
--- a/eco_proc.erl
+++ b/src/eco_proc.erl
diff --git a/eco_tb.erl b/src/eco_tb.erl
index c13bb5d..82119f6 100644
--- a/eco_tb.erl
+++ b/src/eco_tb.erl
@@ -2,7 +2,11 @@
-export([start/0]).
start() ->
- Watcher = spawn(eco_watcher, watcher, []),
+ Watcher = spawn(eco_watcher, watcher, [self()]),
Pool = spawn(eco_pool, start_pool, [[1,1,1]]),
Proc1 = spawn(eco_proc, proc, [Watcher, [1], [], Pool, 3, 3]),
- _Ticker = spawn(eco_time, ticker, [Watcher, 1000, [Proc1], 3000]).
+ _Ticker = spawn(eco_time, ticker, [Watcher, 1000, [Proc1], 3000]),
+ receive
+ {error, notock, _, _} ->
+ init:stop()
+ end.
diff --git a/eco_time.erl b/src/eco_time.erl
index 587cca5..587cca5 100644
--- a/eco_time.erl
+++ b/src/eco_time.erl
diff --git a/src/eco_watcher.erl b/src/eco_watcher.erl
new file mode 100644
index 0000000..ce14ab4
--- /dev/null
+++ b/src/eco_watcher.erl
@@ -0,0 +1,16 @@
+-module(eco_watcher).
+-export([watcher/1]).
+
+watcher(Super) ->
+ receive
+ {From, stop} ->
+ From ! {ok, stopped},
+ {ok, stopped};
+ {error, notock, A, B} ->
+ Super ! {error, notock, A, B},
+ io:format("~p~n", [{error, notock, A, B}]),
+ watcher(Super);
+ Msg ->
+ io:format("~p~n", [Msg]),
+ watcher(Super)
+ end.