summaryrefslogtreecommitdiff
path: root/src/counter.erl
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-31 12:36:59 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-10-31 12:36:59 +0100
commit3f07fdc48606b7c9c22fadda29ef44c41ab9a693 (patch)
tree548107fe4f32e82f5e69820ce51f7eb69ca455bc /src/counter.erl
parent48af65ae8dcdd3b0760db304716a41e1f512c261 (diff)
User generic macro as pid
Diffstat (limited to 'src/counter.erl')
-rw-r--r--src/counter.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/counter.erl b/src/counter.erl
index b8db3e1..e566d6c 100644
--- a/src/counter.erl
+++ b/src/counter.erl
@@ -5,7 +5,7 @@
-define(MAXCOUNT, 32767).
start() ->
- register(counterPid, spawn_link(?MODULE, counter, [])).
+ register(?MODULE, spawn_link(?MODULE, counter, [])).
counter() ->
process_flag(trap_exit, true),
@@ -29,13 +29,13 @@ count(N) ->
end.
set({present, N}) ->
- counterPid ! {set, N+1}.
+ ?MODULE ! {set, N+1}.
next() ->
- counterPid ! {next, self()},
+ ?MODULE ! {next, self()},
receive
{next, N} -> {present, N}
end.
stop() ->
- counterPid ! {stop}.
+ ?MODULE ! {stop}.