Using mutex on all access to the internal directory nodes in StreamIndexedIO
Using mutex on all access to the internal directory nodes in StreamIndexedIO

The previous change introduced a bug where a multi-threaded access to the hierarchy could cause access to deleted SubIndexNode instances.
The solution was to use mutex before accessing the children of any DirectoryNode and for that I've added a function that returns a scoped_lock with the required access (read/write) only the directory actually requires locking (in case it has one or more SubIndexNode as child).
Instead of using one single mutex for all locations in the file, I've created a pool of mutexes that are chosen deterministically for the DirectoryNode to be accessed, in the attempt to avoid blocking threads too much.

hradec/cortex,appleseedhq/cortex,hradec/cortex,appleseedhq/cortex,goddardl/cortex,lento/cortex,lento/cortex,appleseedhq/cortex,goddardl/cortex,lento/cortex,goddardl/cortex,hradec/cortex