Skip to content

Commit

Permalink
Fixing demo example in README
Browse files Browse the repository at this point in the history
Also clearing compile warnings in test dispatcher
  • Loading branch information
ferd committed Apr 1, 2012
1 parent 4681e44 commit bb96186
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.markdown
Expand Up @@ -140,9 +140,15 @@ Here's a similar callback module to handle HTTP sockets (untested):
{error, busy, State};
checkout(From, State = #state{resource=Socket}) ->
gen_tcp:controlling_process(Socket, From),
{ok, Socket, State#state{given=true}}.
%% We give our own pid back so that the client can make this
%% callback module the controlling process again before
%% handing it back.
{ok, {self(), Socket}, State#state{given=true}}.

checkin(Socket, State = #state{resource=Socket, given=true}) ->
%% This assumes the client made us the controlling process again.
%% This might be done via a client lib wrapping dispcount calls of
%% some sort.
{ok, State#state{given=false}};
checkin(_Socket, State) ->
%% The socket doesn't match the one we had -- an error happened somewhere
Expand Down Expand Up @@ -195,3 +201,4 @@ The error you see is likely `{start_spec,{invalid_shutdown,infinity}}`. This is
- More complete testing suite.
- Adding a function call to allow the transfer of ownership from a process to another one to avoid messing with monitoring in the callback module.
- Testing to make sure the callback modules can be updated with OTP relups and appups. This is so far untested.
- Allowing dynamic resizing of pools.
2 changes: 1 addition & 1 deletion test/ref_dispatch.erl
Expand Up @@ -11,7 +11,7 @@ checkout(_From, Ref) ->

checkin(Ref, undefined) ->
{ok, Ref};
checkin(SomeRef, Ref) ->
checkin(_SomeRef, Ref) ->
{ignore, Ref}.

dead(undefined) ->
Expand Down

0 comments on commit bb96186

Please sign in to comment.