Network backend: Add proper locking

This commit makes the network backend thread-safe: itallows multiple
threads to use the same IIO context. Not that it is a good idea though.

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>