diff options
author | Zandra Hird <[email protected]> | 2015-03-16 13:18:37 +0100 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-03-16 13:18:59 +0100 |
commit | da0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1 (patch) | |
tree | d970a02c19f9e5c31d600ea5b26ece53142f20e1 /lib/stdlib/src | |
parent | 3e2070b328b7c2c5f641f3b73a52d6cb7e3b5a44 (diff) | |
parent | 0e464f7be1ae9b54d0fba748ab2dc7bd435ac118 (diff) | |
download | otp-da0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1.tar.gz otp-da0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1.tar.bz2 otp-da0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1.zip |
Merge branch 'nox/ets-update_counter-4'
* nox/ets-update_counter-4:
Create new BIF ets:update_counter/4
Allow 4-ary BIFs
OTP-12563
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/ets.erl | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/stdlib/src/ets.erl b/lib/stdlib/src/ets.erl index 09c8924650..1df069755d 100644 --- a/lib/stdlib/src/ets.erl +++ b/lib/stdlib/src/ets.erl @@ -72,7 +72,7 @@ select_count/2, select_delete/2, select_reverse/1, select_reverse/2, select_reverse/3, setopts/2, slot/2, take/2, - update_counter/3, update_element/3]). + update_counter/3, update_counter/4, update_element/3]). -spec all() -> [Tab] when Tab :: tab(). @@ -439,6 +439,38 @@ take(_, _) -> update_counter(_, _, _) -> erlang:nif_error(undef). +-spec update_counter(Tab, Key, UpdateOp, Default) -> Result when + Tab :: tab(), + Key :: term(), + UpdateOp :: {Pos, Incr} + | {Pos, Incr, Threshold, SetValue}, + Pos :: integer(), + Incr :: integer(), + Threshold :: integer(), + SetValue :: integer(), + Result :: integer(), + Default :: tuple(); + (Tab, Key, [UpdateOp], Default) -> [Result] when + Tab :: tab(), + Key :: term(), + UpdateOp :: {Pos, Incr} + | {Pos, Incr, Threshold, SetValue}, + Pos :: integer(), + Incr :: integer(), + Threshold :: integer(), + SetValue :: integer(), + Result :: integer(), + Default :: tuple(); + (Tab, Key, Incr, Default) -> Result when + Tab :: tab(), + Key :: term(), + Incr :: integer(), + Result :: integer(), + Default :: tuple(). + +update_counter(_, _, _, _) -> + erlang:nif_error(undef). + -spec update_element(Tab, Key, ElementSpec :: {Pos, Value}) -> boolean() when Tab :: tab(), Key :: term(), |