Use read-only naming for Module operations
This commit is contained in:
@@ -25,7 +25,7 @@ start_link() ->
|
||||
|
||||
init(ok) ->
|
||||
%% The table where we store module definitions
|
||||
_ = ets:new(elixir_modules, [set, protected, named_table, {read_concurrency, true}]),
|
||||
_ = ets:new(elixir_modules, [set, public, named_table, {read_concurrency, true}]),
|
||||
{ok, #elixir_code_server{}}.
|
||||
|
||||
handle_call({defmodule, Module, Pid, Tuple}, _From, Config) ->
|
||||
@@ -40,9 +40,6 @@ handle_call({defmodule, Module, Pid, Tuple}, _From, Config) ->
|
||||
handle_call({undefmodule, Ref}, _From, Config) ->
|
||||
{reply, ok, undefmodule(Ref, Config)};
|
||||
|
||||
handle_call({unopenmodule, Ref}, _From, Config) ->
|
||||
{reply, ok, unopenmodule(Ref, Config)};
|
||||
|
||||
handle_call({acquire, Path}, From, Config) ->
|
||||
Current = Config#elixir_code_server.required,
|
||||
case maps:find(Path, Current) of
|
||||
@@ -158,12 +155,3 @@ undefmodule(Ref, #elixir_code_server{mod_ets=ModEts} = Config) ->
|
||||
error ->
|
||||
Config
|
||||
end.
|
||||
|
||||
unopenmodule(Ref, #elixir_code_server{mod_ets=ModEts} = Config) ->
|
||||
case maps:find(Ref, ModEts) of
|
||||
{ok, Mod} ->
|
||||
ets:update_element(elixir_modules, Mod, {5, false}),
|
||||
Config;
|
||||
error ->
|
||||
Config
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user