More multi-threading woes?

posted in I am a duck
Published July 11, 2006
Advertisement
By the time I'm done with my current engine I am going to be a DirectX multi-threading wizard. There are just so many little things that can go wrong and I think I've hit every single one of them.

My latest snag comes about in the way of a random crash at startup deep in the bowels of loading an ogg audio file. This code hasn't changed in months so it's not a new bug in that code but I recently did some tweaking to the resource manager and I believe I've found my problems. Once again it's not a coding error but a design error.

In my drive to make all my resources load async and from the same place I put all my texture and audio loading routines into a single class. This class processes resource requests from all other objects through a messaging system so it can always load things on the same thread. I stuck this processing on my renderer thread because DX doesn't like sharing a D3D device between threads.

Ends up DX also doesn't like sharing Direct Music devices between threads either. So tonight I'll be having a little refactoring party where I rip out all the audio stuff into it's own resource manager and stick it on the same thread as the audio engine.

The worst part about these bugs is they are so hard to track down. There's no sane error code that lets you know what your problem is. You just end up getting weird behaviour or a crash. To be honest I'm still not 100% sure that this is the problem. I'm not going to know until after the refactoring. Even then I'll need to run things for a while to make sure the crash doesn't happen again.

Ain't software fun?
0 likes 2 comments

Comments

Jason Z
You could always just run in single-threaded mode and see if it happens. I guess that wouldn't give you a positive indication even if it doesn't happen in single threaded mode though.

I haven't had to deal with the complexities of multi-threading and it sounds like I will be waiting for a little while until I can do some reading on it.

I hope you found the real root cause...

July 12, 2006 06:01 AM
noaktree
Quote:Ain't software fun?
Yeah using it...but what you're doing doesn't sound fun. Multithreaded debugging hell!!! Good luck with the refactoring.
July 12, 2006 06:27 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement