PULSE bugfix: race with finish_init message

This commit is contained in:
Scott Lystig Fritchie 2014-02-17 00:52:15 +09:00
parent a294a0eff0
commit bcc6cf1e6a
2 changed files with 3 additions and 1 deletions

View file

@ -135,6 +135,9 @@ init({Dir, ExpPageSize, ExpMaxMem}) ->
self() ! finish_init, % TODO
{ok, State}.
handle_call(Call, From, #state{max_logical_page=unknown} = State) ->
{noreply, NewState} = handle_info(finish_init, State),
handle_call(Call, From, NewState);
handle_call({write, ClientEpoch, _LogicalPN, _PageBin}, _From,
#state{min_epoch=MinEpoch} = State)
when ClientEpoch < MinEpoch ->

View file

@ -50,7 +50,6 @@ get(Pid, NumPages) ->
init({FLUs}) ->
MLP = get_max_logical_page(FLUs),
io:format(user, "~s:init: MLP = ~p\n", [?MODULE, MLP]),
{ok, MLP + 1}.
handle_call({get, NumPages}, _From, MLP) ->