Game Development Community

When I try to exit, it freezes

by Bulent COSKUN · in Torque 3D Professional · 06/24/2009 (8:56 pm) · 13 replies

When I load Genre kit and try to exit to application window freezes but Purelight Demo is working fine. I believe something in Genre kit causes this issue.

I tried with Vista and Windows 7 64 bit OS'.

#1
06/25/2009 (5:56 am)
I'm having the same issue with Vista 32-bit. PureLIGHT demo is OK but both the PhysX and Genre Kit lock up when shutting down if a mission was loaded.

I'm also getting fairly consistent lockups when the window re-gains focus after a few minutes in the background.

I'll build a debug version and see if I can trace down more details this evening.

#2
06/25/2009 (8:07 am)

This is probably the same thing as this one.

I'm suspecting SFX shutdown. Are you using different SFX devices with Genre Kit and the pureLIGHT demo?

A stack trace would be tremendously helpful.

#3
06/25/2009 (8:52 am)
Quote:This is probably the same thing as this one.

Agreed. I'll look into it this evening and follow up in the other thread. Getting a stack trace shouldn't be a problem.
#4
06/26/2009 (2:29 pm)
I am having this problem, and yes it's in SFX shutdown in the thread destruction.
#5
06/26/2009 (2:53 pm)
Okay, I am very sure it is related with sound system. And when i realize there is no sound at all. At my workplace I tried with different computer and all sound was okay and there was no freezing.

I can describe when it happens.
1-Open FPS Genre Kit
2-Select Orc camp or any mission it has sound.
3-If you don't have sound ( symptom )
3.1- ether exit game directly with close window method.
3.2- or go back to main menu try to select different audio provider.
FREEZE...
4- If you have sound you are lucky you don't have freezing issue.

Question is why some machines have sound provider issue?
#6
06/26/2009 (4:54 pm)
Please go into platform/threads/threadPool.cpp and replace the following

CPUInfo::CPUCount( numLogical, numCores, numPhysical );

      mNumThreads = ( numCores - 1 ) * 4;

with:

CPUInfo::CPUCount( numLogical, numCores, numPhysical );

      const U32 baseCount = getMax( numLogical, numCores );
      if( baseCount )
         mNumThreads = baseCount * 2;
      else
         mNumThreads = 2;

This should solve the no-sound as well as the lockup issues.

This stunning feat of incompetence in elementary math (*) affected all single-core systems as well as those where the detection code failed.

(*) that code was mine...
#7
06/26/2009 (6:42 pm)
Thanks you are right it fixes freezing and sound issue.

But let me ask a question about this code modification.
When I debug to code numCores was 1 which it doesn't make sense because I have 4 core CPU, So that means CPUInfo::CPUCount method is failing with AMD Phenom 9950 Quad-Core CPU.

#8
06/26/2009 (6:45 pm)
Yep, already fixed that in the other threads that are related to this issue. Modified the snippet above, too.

Basically, for AMD, the cores come out reported as logical processors instead of cores. The modification above takes this into account.

//Edit: If this fixes the incorrect processor count for you, please leave a message. Thank you.
#9
06/26/2009 (7:04 pm)
yes this time it found 4 and it creates 8 threads but I want to ask you one more question.

When i check task manager/performance tab it looks like all code running only 1. core. Is it make any sense to you? Because what i thought when i see this code going to split load different cores.
and last of all, Is Torque really use multi cores CPU advantages?
I saw some OMP command in just one file and it was not enabled.

Any ideas?
#10
06/26/2009 (7:13 pm)

Hmm, that sounds like thread affinity is set up incorrectly. The CPU count code does use this during detection but should properly reset it. I'll look into it.
#11
06/26/2009 (7:16 pm)

//Edit: Deleted this. Was too quick. Profiler sets affinity only for main thread and not for process.
#12
06/26/2009 (7:39 pm)

Seems this is a misunderstanding. I assumed you meant that none of the threads got to run on other cores. However, you probably meant (quite like you've written) that you are expecting Torque to distribute its work load to the different cores.

Torque isn't yet multithreaded to that point. Most of the work still happens on the main thread. The worker threads only carry out very specific tasks at the moment (SFX loading is one) and will probably see more utilization in the future.
#13
06/26/2009 (7:43 pm)
I got it now, because i was checking code i got same conclusion just i want to confirm with someone who knows the torque code better than me and it is good thing to know better utilization on the way.

Thanks again.