Some issues I found below:
1. ResourceGroupManager::getSingleton().unloadResourceGroup is called in ResourceBackgroundQueue::handleRequest. However, resource cannot be unloaded in work thread. For unload resource group, It must be called in ResourceBackgroundQueue::handleResponse which is in main thread.
2. With ResourceGroupManager, I suggest remove OGRE_LOCK_AUTO_MUTEX with createResourceGroup, getResourceGroup and isResourceGroupInGlobalPool and add comment they are not thread safe, that means these three methods must be called in main thread. Another option is add more mutexes for different using like "add/remove ResourceGroupListener". Using only one OGRE_AUTO_MUTEX for all methods will cause deadlock and lag.
Deadlock situation generally because main thread lock ResourceGroupManager::mutex first and lock ResourceManager::mutex second, and work thread lock ResourceManager::mutex first and lock ResourceGroupManager::mutex second.
Call stack with main/work thread below.
"AB" in Main thread. "BA" in work thread 3. For smooth with loading single resources that prepared in work thread, and then load in main thread. If smooth with loading resource group, we can initialiseResourceGroup and prepareResourceGroup in work thread, and then load resource in this resource group one by one in main thread.
I wrote my own ResourceGroupBackgroundLoader class to do this, it works fine, code attached for your reference. Review is welcome.
