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" to the respective workers, and waits for the workers (one by one) to respond.
- workers respond with a "total_result n" followed by n "result ... messages", and a final "end" message.

@dpandiar, @dthain