take_queued_work_bymidstate should use a write lock.
Merge branch 'master' of github.com:ckolivas/cgminer