Skip to content

Commit

Permalink
implement Timer.terminate/2 and fix related message
Browse files Browse the repository at this point in the history
```
warning: Rclex.Timer.terminate_timer/2 is undefined or private. Did you mean one of:

      * terminate/2

  lib/rclex.ex:83: Rclex.waiting_input/2
```
  • Loading branch information
takasehideki committed Nov 30, 2021
1 parent 49a8cf5 commit 2915de5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/rclex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ defmodule Rclex do
|> String.to_integer()

case num do
0 -> Rclex.Timer.terminate_timer(sv, child)
0 -> Rclex.Timer.terminate(sv, child)
_ -> waiting_input(sv, child)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rclex/sub_loop.ex
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ defmodule Rclex.SubLoop do

# def terminate(:normal, state) do
def terminate(:normal, _) do
Logger.debug("loop process killed : normal")
Logger.debug("sub_loop process killed : normal")
end

# def terminate(:shutdown, state) do
def terminate(:shutdown, _) do
Logger.debug("loop process killed : shutdown")
Logger.debug("sub_loop process killed : shutdown")
end

def do_nothing() do
Expand Down
2 changes: 1 addition & 1 deletion lib/rclex/subscriber.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ defmodule Rclex.Subscriber do
end

def terminate(:normal, _) do
Logger.debug("sub terminate")
Logger.debug("terminate subscriber")
end

# defp do_nothing do
Expand Down
4 changes: 4 additions & 0 deletions lib/rclex/timer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ defmodule Rclex.Timer do
Supervisor.stop(loop_supervisor_id)
{:stop, :normal, {callback, args, time, loop_supervisor_id}}
end

def terminate(:normal, _) do
Logger.debug("terminate timer")
end
end
8 changes: 8 additions & 0 deletions lib/rclex/timer_loop.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ defmodule Rclex.TimerLoop do
end
end

def terminate(:normal, _) do
Logger.debug("timer_loop process killed : normal")
end

def terminate(:shutdown, _) do
Logger.debug("timer_loop process killed : shutdown")
end

def do_nothing() do
end
end

0 comments on commit 2915de5

Please sign in to comment.