Hello!
I'm still new to multithreading, so forgive my ignorance if there's a painfully solution to my problem. [grin]
First of all, I'm doing this to create my Direct3D object:
DXStuff->g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DXStuff->hWnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED,
&d3dpp, &DXStuff->g_pd3dDevice )
When I first start my game engine, I start an animated splashscreen for the player to see while game textures and sounds are loaded in the background. Here's how I load this splashscreen code:
_beginthread(SplashThread, 0, &sParams);
and here's the code for the above call:
void SplashThread(PVOID pvoid)
{
PPARAMS pparams;
pparams = (PPARAMS) pvoid;
while (!pparams->threadDone)
{
UpdateGameTimer(pparams->DXStuff);
RenderSplash(pparams->DXStuff, pparams->DXEnts);
}
CleanupSplash();
_endthread();
}
When I'm done loading the game, I exit out of the SplashThread with "pparams->threadDone = true;"
What's weird is that my game engine seems to be using an awful lot of CPU power than if I'm not using multithreading. Is it possible the SplashThread is still running in another thread even if I've ended it? Or, maybe it hasn't
completely ended? Is there a way I can ensure ALL splash-related threads are completely closed when the game is completely loaded?
Thanks in advance for the help!