Implement non-blocking shutdown command

This change separates out the terminate process into 2 parts, the part that unblocks any blocked operations on other threads and the part that waits for all the open sockets to be closed.

I'm not really sure about the name, this is an optional call, zmq_ctx_term will still do the first part if zmq_ctx_shutdown is not called and it might lead to people being confused about what they have to call.

The use case for this is to support the following workflow:

Main thread     |      Receiver thread
----------------------|-----------------------
create context |
create socket  |
spawn receiver |
                      |       Block receiving
Do stuff           |
shutdown context |
                      |     Unblock
wait for thread to complete  |                           
close socket   |
close context  |

I'd like to use the workflow in my C++ project, where I'd like the socket close to occur in the destructors, but currently I have to manually close the sockets in the receiver thread otherwise the main thread will hang trying to close the context.