Skip to content

Commit

Permalink
Add unused to lock
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Sobkiewicz <[email protected]>
  • Loading branch information
TheSobkiewicz committed Jan 9, 2025
1 parent eaed2ed commit 1a801a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added the ability to run beams from the CLI for Generic Unix platform (it was already possible with nodejs and emscripten).
- Added support for 'erlang:--/2'.
- Added support for list insertion in 'ets:insert/2'.
- Added support for 'ets:delete/1'.

### Fixed

Expand Down
10 changes: 10 additions & 0 deletions libs/estdlib/src/ets.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
insert/2,
lookup/2,
lookup_element/3,
delete/1,
delete/2
]).

Expand Down Expand Up @@ -101,3 +102,12 @@ lookup_element(_Table, _Key, _Pos) ->
-spec delete(Table :: table(), Key :: term()) -> true.
delete(_Table, _Key) ->
erlang:nif_error(undefined).
%%-----------------------------------------------------------------------------
%% @param Table a reference to the ets table
%% @returns true; otherwise, an error is raised if arguments are bad
%% @doc Delete an ets table.
%% @end
%%-----------------------------------------------------------------------------
-spec delete(Table :: table()) -> true.
delete(_Table) ->
erlang:nif_error(undefined).
3 changes: 2 additions & 1 deletion src/libAtomVM/ets.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ EtsErrorCode ets_drop_table(term name_or_ref, term *ret, Context *ctx)
return EtsPermissionDenied;
}

synclist_wrlock(&ctx->global->ets.ets_tables);
struct ListHead *_ets_tables_list = synclist_wrlock(&ctx->global->ets.ets_tables);
UNUSED(_ets_tables_list);
SMP_UNLOCK(ets_table);
list_remove(&ets_table->head);
ets_table_destroy(ets_table, ctx->global);
Expand Down

0 comments on commit 1a801a2

Please sign in to comment.