Wq deadlock fixes

Fix for issue #274

- Workers do not send results immediately, now they send a message "available_results".
- When master sees "available_results", it pushes the worker into a list.
- Eventually, the master goes through that list, sending "send_results n" to the respective workers, and waits for the workers (one by one) to respond. n is the maximum number of results to send. n == -1 means send all.
- workers respond with at most n "result ... messages", and a final "end" message.

@dpandiar, @dthain