nanomsg/nanomsg — pull request #169 by tailhook (2013-10-11 19:17:55+00:00)
Title: Fix race condition between closing usock and removing pipe

Added USOCK_SHUTDOWN event at which sent to owner, makes owner to stop the pipe and nn_sock_rm() it.

This patch is relies very much on the internals of the event processing in nn_ctx_leave() to deliver USOCK_SHUTDOWN before executing task_stop. If you're not ok with that, I can fix it, but it probably means I must add another state in every object that just ignores USOCK_SHUTDOWN event now.

Note, pull request contains two commits, first just enhances few assertions a bit.