Fixed case when waiter is the same process as one being registered #7

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@idubrov
idubrov commented Jul 11, 2011

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.

@uwiger
Owner
uwiger commented Jul 20, 2011

Thanks. I have implemented a slightly different fix in https://github.com/esl/gproc/tree/v0.2.8

I keep the esl version more current, and only occasionally push to the uwiger version.

@uwiger uwiger closed this Jul 20, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment