Ensure thread safety of nonces and private API requests
Ensure thread safety of nonces and private API requests

Private API requests *must* be made consecutively. This is enforced by
the nonces. Since it is highly improbable that any two requests reach
the server at the exact same time, and even if they do, each request
needs to have a nonce at least one higher than the last request.

This is resolved by wrapping the actual request within a lock. This
lock is a RLock as other threads should not be able to interfere
with the request being sent. The nonce_iter is consumed within the
lock, also for the sake of thread safety. Generators can't be
resumed more than once from multiple threads before fully pausing
again, so without being within a lock, a ValueError could be raised.

Aula13/poloniex