/////////////////////////////////////////////////////////////////////
| 582 | |
| 583 | ////////////////////////////////////////////////////////////////////////// |
| 584 | int CSystem::GetApplicationInstance() |
| 585 | { |
| 586 | #if CRY_PLATFORM_WINDOWS |
| 587 | if (m_iApplicationInstance == -1) |
| 588 | { |
| 589 | string suffix; |
| 590 | for (int instance = 0;; ++instance) |
| 591 | { |
| 592 | suffix.Format("(%d)", instance); |
| 593 | |
| 594 | HANDLE instanceMutex = CreateMutex(NULL, TRUE, "CrytekApplication" + suffix); |
| 595 | // search for duplicates |
| 596 | if (GetLastError() != ERROR_ALREADY_EXISTS) |
| 597 | { |
| 598 | m_iApplicationInstance = instance; |
| 599 | break; |
| 600 | } |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | return m_iApplicationInstance; |
| 605 | #else |
| 606 | return 0; |
| 607 | #endif |
| 608 | } |
| 609 | |
| 610 | // refreshes the m_pMemStats if necessary; creates it if it's not created |
| 611 | ////////////////////////////////////////////////////////////////////////// |
no test coverage detected