erlang:cancel_timer/1

Frank Muller frank.muller.erl@REDACTED
Sun Jan 24 00:01:12 CET 2021


On both MacOS (any) and Linux (Ubuntu 20.04 LTS):

Why this works?

Erlang/OTP 22 [erts-10.7.2.5] [source] [64-bit] [smp:12:12] [ds:12:12:10]
[async-threads:1]
Eshell V10.7.2.5  (abort with ^G)
1> self().
<0.89.0>

2> TRef = erlang:send_after(9000, self(), die).
#Ref<0.2349067310.4021813252.2981>

3> erlang:cancel_timer(TRef).
7288           <--------------- expected/correct

4> self().
<0.89.0>


But this doesn’t:

Erlang/OTP 22 [erts-10.7.2.5] [source] [64-bit] [smp:12:12] [ds:12:12:10]
[async-threads:1]
Eshell V10.7.2.5  (abort with ^G)
1> self().
<0.89.0>

2> TRef = erlang:send_after(9000, self(), die).
#Ref<0.2349067310.4021813252.2981>

3> erlang:put(die_tref, TRef).
undefined

4> TRef = erlang:get(die_tref).
#Ref<0.2349067310.4021813252.2981>

5> erlang:cancel_timer(TRef).
false          <------------------ hmmm

6> self().
<0.89.0>


Am I missing something? Maybe I need some rest.

/Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210124/dcce336d/attachment.htm>


More information about the erlang-questions mailing list