aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Lasseter <Nathan Lasseter nathan@bytemark.co.uk>2014-05-30 13:44:47 +0100
committerNathan Lasseter <Nathan Lasseter nathan@bytemark.co.uk>2014-05-30 13:44:47 +0100
commit6366b41c9ed633a975bf37527f97c29efe2a1da5 (patch)
tree1e34bd416f4274cb4b40afc2997ad7d5714a2762
parent08fecb93995728ab53d78beefc329331d79f303f (diff)
Updated Makefile to take tb as argumentHEADmaster
-rw-r--r--Makefile10
-rw-r--r--src/eco_tb.erl15
2 files changed, 22 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 2dfb4cc..66fceee 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,11 @@
+# If the first argument is "run"...
+ifeq (run,$(firstword $(MAKECMDGOALS)))
+ # use the rest as arguments for "run"
+ RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
+ # ...and turn them into do-nothing targets
+ $(eval $(RUN_ARGS):;@:)
+endif
+
MODULES=eco_pool eco_proc eco_time eco_watcher eco_tb
PREREQS=$(addprefix bin/, $(addsuffix .beam, ${MODULES}))
@@ -7,7 +15,7 @@ PREREQS=$(addprefix bin/, $(addsuffix .beam, ${MODULES}))
all: bin/ ${PREREQS}
run: bin/ ${PREREQS}
- erl -pz bin/ -noshell -run eco_tb start
+ erl -pz bin/ -noshell -run eco_tb $(RUN_ARGS)
clean:
rm -r bin erl_crash.dump
diff --git a/src/eco_tb.erl b/src/eco_tb.erl
index 82119f6..a74d005 100644
--- a/src/eco_tb.erl
+++ b/src/eco_tb.erl
@@ -1,7 +1,7 @@
-module(eco_tb).
--export([start/0]).
+-compile(export_all).
-start() ->
+oneprocsixtickdeath() ->
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]),
@@ -10,3 +10,14 @@ start() ->
{error, notock, _, _} ->
init:stop()
end.
+
+twoprocsbackandforth() ->
+ Watcher = spawn(eco_watcher, watcher, [self()]),
+ Pool = spawn(eco_pool, start_pool, [[1,2]]),
+ Proc1 = spawn(eco_proc, proc, [Watcher, [1], [2], Pool, 3, 3]),
+ Proc2 = spawn(eco_proc, proc, [Watcher, [2], [1], Pool, 3, 3]),
+ _Ticker = spawn(eco_time, ticker, [Watcher, 1000, [Proc1, Proc2], 3000]),
+ receive
+ {error, notock, _, _} ->
+ init:stop()
+ end.