• entries
    205
  • comments
    228
  • views
    112808

More multi-threading woes?

Sign in to follow this  
Mike Bossy

75 views

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?
Sign in to follow this  


2 Comments


Recommended Comments

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...

Share this comment


Link to comment
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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now