aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/counters.erl
diff options
context:
space:
mode:
Diffstat (limited to 'erts/preloaded/src/counters.erl')
-rw-r--r--erts/preloaded/src/counters.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/erts/preloaded/src/counters.erl b/erts/preloaded/src/counters.erl
index 67354f648d..a0e3035e0f 100644
--- a/erts/preloaded/src/counters.erl
+++ b/erts/preloaded/src/counters.erl
@@ -26,6 +26,7 @@
get/2,
add/3,
sub/3,
+ put/3,
info/1]).
-export_type([counters_ref/0]).
@@ -76,6 +77,19 @@ add(_, _, _) ->
sub(Ref, Ix, Decr) ->
add(Ref, Ix, -Decr).
+
+-spec put(Ref, Ix, Value) -> ok when
+ Ref :: counters_ref(),
+ Ix :: integer(),
+ Value :: integer().
+put({atomics, Ref}, Ix, Value) ->
+ atomics:put(Ref, Ix, Value);
+put({write_concurrency, Ref}, Ix, Value) ->
+ erts_internal:counters_put(Ref, Ix, Value);
+put(_, _, _) ->
+ erlang:error(badarg).
+
+
-spec info(Ref) -> Info when
Ref :: counters_ref(),
Info :: #{'size':=Size, 'memory':=Memory},