Note that there are some explanatory texts on larger screens.

plurals
  1. POrelease mode error, but not in debug mode
    primarykey
    data
    text
    <p>My code runs fine in debug mode but fails in release mode.</p> <p>Here's a snippet of my code where it fails:</p> <pre><code>LOADER-&gt;AllocBundle(&amp;m_InitialContent); while(!m_InitialContent.isReady()) { this-&gt;LoadingScreen(); } </code></pre> <p>AllocBundle() will load the content contained in m_InitialContent and set it's ready status to true when it is done. This is implemented using multithreading.</p> <p><code>this-&gt;LoadingScreen()</code> should render a loading screen, however at the moment that is not implemented yet so the function has an empty body.</p> <p>Apparently this might be the cause of the error: If I give the function LoadingScreen() one line of code: <code>std::cout&lt;&lt;"Loading"&lt;&lt;std::endl;</code> then it will run fine. </p> <p>If I don't, then the code gets stuck at <code>while(!m_InitialContent.isReady())</code> It never even jumps to the code between the brackets (<code>this-&gt;LoadingScreen();</code>). And apparently neither does it update the expression in the while statement because it stays stuck there forever.</p> <p>Does anyone have any ideas what might be causing this? And if so, what might the problem be? I'm completely puzzled.</p> <hr> <p>EDIT: Additional code on request</p> <p>member of ContentLoader: <code>details::ContentBundleAllocator m_CBA;</code></p> <pre><code> void ContentLoader::AllocBundle(ContentBundle* pBundle) { ASSERT(!(m_CBA.isRunning()), "ContentBundleAllocator is still busy"); m_CBA.Alloc(pBundle, m_SystemInfo.dwNumberOfProcessors); } void details::ContentBundleAllocator::Alloc(ContentBundle* pCB, UINT numThreads) { m_bIsRunning = true; m_pCB = pCB; pCB-&gt;m_bIsReady = false; m_NumRunningThrds = numThreads; std::pair&lt;UINT,HANDLE&gt; p; for (UINT i = 0; i &lt; numThreads; ++i) { p.second = (HANDLE)_beginthreadex(NULL, NULL, &amp;details::ContentBundleAllocator::AllocBundle, this, NULL,&amp;p.first); SetThreadPriority(p.second,THREAD_PRIORITY_HIGHEST); m_Threads.Insert(p); } } unsigned int __stdcall details::ContentBundleAllocator::AllocBundle(void* param) { //PREPARE ContentBundleAllocator* pCBA = (ContentBundleAllocator*)param; //LOAD STUFF [collapsed for visibility+] //EXIT=========================================================================================================== pCBA-&gt;m_NumRunningThrds -= 1; if (pCBA-&gt;m_NumRunningThrds == 0) { pCBA-&gt;m_bIsRunning = false; pCBA-&gt;m_pCB-&gt;m_bIsReady = true; pCBA-&gt;Clear(); #ifdef DEBUG std::tcout &lt;&lt; std::endl; #endif std::tcout&lt;&lt;_T("exiting allocation...")&lt;&lt;std::endl; } std::tcout&lt;&lt;_T("exiting thread...")&lt;&lt;std::endl; return 0; } bool isReady() const {return m_bIsReady;} </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload