Attempt at a multithreaded write access.

Signed-off-by: Jean-Yves Tinevez <jeanyves.tinevez@gmail.com>