Game Development Community

TGEA 1.7.1 Bug - turning of TORQUE_MULTITHREAD results in error

by Jaimi McEntire · in Torque Game Engine Advanced · 07/19/2008 (8:31 pm) · 0 replies

Turning on TORQUE_MULTITHREAD runs D3D in multi-thread mode. Since this is supposed to be a performance hit, I turned it off, to see if it would make any difference. This results in an error in the following function in WinWindow.cpp because an #endif is out of place

bool Platform::checkOtherInstances(const char *mutexName)
{
#ifdef TORQUE_MULTITHREAD

	HANDLE pMutex	=	NULL;
#ifdef UNICODE
   UTF16 b[512];
   convertUTF8toUTF16((UTF8 *)mutexName, b, sizeof(b));
   pMutex  = CreateMutex(NULL, true, b);
#else
   pMutex = CreateMutex(NULL, true, mutexName);
#endif
   if(!pMutex)
      return false;

   if(GetLastError() == ERROR_ALREADY_EXISTS)
   {
	   //another mutex of the same name exists
	   //close ours
      CloseHandle(pMutex);
      pMutex = NULL;
      return true;
   }

// #endif  was here
     CloseHandle(pMutex);
     pMutex = NULL;
#endif

   //we don't care, always false
   return false;
}