Last active
March 5, 2019 14:02
-
-
Save haakov/2c6048a4cc4e782bb7df71dd7bab81ff to your computer and use it in GitHub Desktop.
Revisions
-
haakov revised this gist
Mar 5, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,4 +13,4 @@ end #To run: # this_pid = self # spawn fn -> Elevator.Timer.keepalive_timer(this_pid, 1, 5000) end -
haakov revised this gist
Mar 5, 2019 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,6 @@ defmodule Elevator.Timer do end end #To run: # this_pid = self # Elevator.Timer.keepalive_timer(this_pid, 1, 5000) -
haakov created this gist
Mar 5, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ defmodule Elevator.Timer do def keepalive_timer(parent, id, msecs) do receive do :keepalive -> keepalive_timer(parent, id, msecs) after msecs -> send(parent, {:timeout, id}) end end end To run: this_pid = self Elevator.Timer.keepalive_timer(this_pid, 1, 5000)