Only allow the mining thread to be cancelled when it is not within driver code, making for cleaner shutdown and allowing us to pthread_join the miner threads on kill_work().
All stratum calls to recv_line are serialised from the one place so there is no need to use locking around recv().
Use a persistent single separate thread for stratum share submission that uses workqueues since all stratum sends are serialised.
Merge branch 'master' into icarus-dev