September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,7 +1,7 @@
defmodule Events do
def log(msg) do
{h,m,s} = :erlang.time
:io.fwrite("~2.B:~2.B:~2.B => ~s~n",[h,m,s,msg])
time = Time.utc_now |> to_string |> String.slice(0..7)
IO.puts "#{time} => #{msg}"
end
def task do
@ -14,12 +14,14 @@ defmodule Events do
def main do
log("Program start")
pid = spawn(Events,:task,[])
{pid,ref} = spawn_monitor(__MODULE__,:task,[])
log("Program sleeping")
:timer.sleep(1000)
Process.sleep(1000)
log("Program signalling event")
send(pid, :go)
:timer.sleep(100)
receive do
{:DOWN,^ref,_,_,_} -> :task_is_down
end
end
end