Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unregister_and_flush call #4

Merged
merged 2 commits into from
Sep 9, 2016
Merged

Add unregister_and_flush call #4

merged 2 commits into from
Sep 9, 2016

Conversation

MagnusS
Copy link
Member

@MagnusS MagnusS commented Sep 9, 2016

Adds unregister_and_flush to allow a node to unregister from the
backend and block until all that node's listener callbacks have returned. This is
particularly useful when using async listeners, as they may still be processing
packets after the listener has been removed from the backend.

Note that this may also block forever if the listener callbacks are not
designed to return (such as in mirage-tcpip).

Each call to the listener callback now increments a counter per mac/node, which is
decremented when the call returns and a condition variable is signalled. The new
unregister_and_flush function will wait for the counter to reach 0 before unregistering
the node id.

Signed-off-by: Magnus Skjegstad <[email protected]>
Adds `unregister_and_flush` to allow a node to unregister from the
backend, but block until all that node's listener callbacks have returned. This is
particularly useful when using async listeners, as they may be running
after the listener has been removed from the backend.

Note that this may also block forever if the listener callbacks are not
designed to return (such as in `mirage-tcpip`).

Signed-off-by: Magnus Skjegstad <[email protected]>
@MagnusS MagnusS merged commit ba13fd0 into master Sep 9, 2016
@MagnusS MagnusS deleted the add-flush branch September 9, 2016 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant