Safe node attaching to root node from external thread?

What would be a thread safe way to attach a node generated in an external thread outside of a standard game to a root node?

The safest way is to use GameTaskQueueManager and attach it inside a callable. Neither the ArrayList nor Node itself is synchronized to work in multiple threads so this is your only option.

Many thanks for info so am I right to do it this way?



public void showObject(final MapObject mo) {
        // GL Thread safe
        GameTaskQueueManager.getManager().update(new Callable<Object>() {

            public Object call() throws Exception {
                zoneNode.attachChild(mo.getObjectRoot());
                return null;
            }
        });
        mo.setCurrentZone(this);
        synchronized (mapObjectCache) {
            mapObjectCache.put(mo);
        }
        zoneNode.updateGeometricState(0, true);
        zoneNode.updateWorldData(0.0f);
        zoneNode.updateRenderState();
    }


zoneNode.updateGeometricState(0, true);
zoneNode.updateRenderState();



You can put also in the call method. dont call updateWorldData, this method is already called by updateGeometricState.

an I had better effects by taking the render method instead of the update. Blending and LightStates are calculated correctly without flickering,