Where am I

24.13. Automatic Read Lock

All standard Open Inventor action classes automatically request a global read lock on the scene graph (by calling the method SoDB::readlock()) before starting their traversal. This has the advantage that methods invoked during a traversal should be able to assume that node fields cannot change during the traversal. As a result, traversal methods must not attempt to acquire the global scene graph write lock (SoDB::writelock()). This will cause a “deadlock” where the requesting thread waits forever for the lock to be granted.

Note that this also applies to callback functions invoked by an SoCallback SoCallback SoCallback node. Therefore callback functions should not attempt to modify the scene graph (it is generally dangerous to modify the scene graph during traversal even in a single-threaded application). A reasonable workaround, in most cases, is to have the callback function schedule an SoOneShotSensor SoOneShotSensor SoOneShotSensor to do the modification after the traversal has been completed.