hello everyone.
I'm a new user of boost thread.
I use boost thread to write a multithread program.
In my program, I wrote a GameManager class which manager process of load image, update game information and render of game.
I use boost thread to load image and render synchronously.
but it has some problem.
When it loading images and render synchronously, it's fine.
but when loading all of images was finished, it starting lag in update and render.
Can anyone tell me what's the problem with my program.
Thanks.
void GameManager::Run()
{
switch (this->gameState)
{
case ME_GAME_INITIAL:
{
// initial game
...
}
case ME_GAME_LOADING:
{
// load some content of game
...
// load other content use boost thread
m_Thread = boost::thread(&GameManager::loadContent_GAME, this);
//m_Thread1 is used to load final Animation of the game
m_Thread1 = boost::thread(&GameManager::loadContent_END, this);
}
case ME_GAME_PLAY:
{
m_Thread.join();
//update game information and render here
...
}
}
...
}