More multi-threading woes?
496
2
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?
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?
Advertisement
Advertisement
Advertisement
Discussion