mirror of
https://github.com/uselessd/alcove.git
synced 2026-04-15 09:15:19 +00:00
Change the message to include the gen_server PID
Modify the message format from:
{pid(), {atom(), [non_neg_integer()], any()}}
To:
{atom(), pid(), [non_neg_integer()], any()}
Using a deeply nested tuple is similar to how port drivers are handled
and is more efficient, since it doesn't require destructuring the tuple
returned from decode/1.
But flat tuples are consistent with the gen_tcp/gen_udp interfaces and
mirror the calling conventions for the rest of alcove, e.g.:
alcove:chdir(pid(), [non_neg_integer()], iodata()])
This commit is contained in:
@@ -207,7 +207,8 @@ code_change(_OldVsn, State, _Extra) ->
|
||||
% Several writes from the child process may be coalesced into 1 read by
|
||||
% the parent.
|
||||
handle_info({Port, {data, Data}}, #state{port = Port, pid = Pid} = State) ->
|
||||
[ Pid ! {self(), Msg} || Msg <- decode(Data) ],
|
||||
[ Pid ! {Tag, self(), Pids, Term} ||
|
||||
{Tag, Pids, Term} <- decode(Data) ],
|
||||
{noreply, State};
|
||||
|
||||
handle_info({'EXIT', Port, Reason}, #state{port = Port} = State) ->
|
||||
@@ -224,7 +225,7 @@ handle_info(Info, State) ->
|
||||
reply(Drv, Pids, Type, Timeout) ->
|
||||
Tag = type_to_atom(Type),
|
||||
receive
|
||||
{Drv, {Tag, Pids, Event}} ->
|
||||
{Tag, Drv, Pids, Event} ->
|
||||
Event
|
||||
after
|
||||
Timeout ->
|
||||
|
||||
Reference in New Issue
Block a user