diff options
author | Rickard Green <[email protected]> | 2017-02-17 18:23:11 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-03-02 17:00:42 +0100 |
commit | d1ad45f0940697f04f334c078a2287cd51e45ad5 (patch) | |
tree | 71ebcd6b08388ad06cba85eaa1669a2e46133d8a /lib/stdlib/src/ets.erl | |
parent | ee7494d5d5c3388a8bb1f012f6411a90f89d8ea6 (diff) | |
download | otp-d1ad45f0940697f04f334c078a2287cd51e45ad5.tar.gz otp-d1ad45f0940697f04f334c078a2287cd51e45ad5.tar.bz2 otp-d1ad45f0940697f04f334c078a2287cd51e45ad5.zip |
Implement ets:all() using scheduler specific data
Diffstat (limited to 'lib/stdlib/src/ets.erl')
-rw-r--r-- | lib/stdlib/src/ets.erl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/stdlib/src/ets.erl b/lib/stdlib/src/ets.erl index d6fd1e3ea1..90e19e6b9f 100644 --- a/lib/stdlib/src/ets.erl +++ b/lib/stdlib/src/ets.erl @@ -75,10 +75,28 @@ take/2, update_counter/3, update_counter/4, update_element/3]). +%% internal exports +-export([internal_request_all/0]). + -spec all() -> [Tab] when Tab :: tab(). all() -> + receive_all(ets:internal_request_all(), + erlang:system_info(schedulers), + []). + +receive_all(_Ref, 0, All) -> + All; +receive_all(Ref, N, All) -> + receive + {Ref, SchedAll} -> + receive_all(Ref, N-1, SchedAll ++ All) + end. + +-spec internal_request_all() -> reference(). + +internal_request_all() -> erlang:nif_error(undef). -spec delete(Tab) -> true when |