This will fail, because gproc:maybe_waiters firstly inserts key in the ETS ({{<0.43.0>,{n,l,somekey}},r}), then invokes notify_waiters which in turn removes the same row from the ETS (since the waiting and registering processes are the same). The patch simply changes the order of two invocations. Firstly it notifies the waiters, then it inserts the row into the ETS.
Consider the following commands given in the shell:
application:start(gproc). gproc:nb_wait({n, l, somekey}). gproc:reg({n, l, somekey}). gproc:unreg({n, l, somekey}).
This will fail, because gproc:maybe_waiters firstly inserts key in the ETS ({{<0.43.0>,{n,l,somekey}},r}), then invokes notify_waiters which in turn removes the same row from the ETS (since the waiting and registering processes are the same). The patch simply changes the order of two invocations. Firstly it notifies the waiters, then it inserts the row into the ETS.