code... Obviously DirectX holds its critical section and invokes
you via a callback. Most likely it's your callback that causes
the deadlock. Or rather the fact it tries to acquire one of your
critical sections held by another thread.
Thanks for the quick response.
In looking at the various callstacks for each thread I could not see where
one of my critical sections were being hit. However, all of the threads
were blocking on an NtWaitForSingleObject or NtWaitForMultipleObjects and
the call stack never showed a path that was leading to any of my critical
sections. With that I said, because of my understanding of some of the
clients that are using Audio Router I was able to determine that it was a
critical section issue. Some clients were performing operations on Audio
Router during the DirectPlay connection. This of courses causes global
data to be modified, thus critical sections were used. I've been looking
at this so long and was getting tunnel vision. Thanks for telling me to
"Stop wasting time right here". Because I was about to spend all weekend
on this one.
Thanks again,
Aaron Smith
"Alexander Nickolov" <agnickolov@mvps.org> wrote in message
news:ufP5ArhwGHA.560@TK2MSFTNGP05.phx.gbl...
Stop wasting time right here. The singleton on its own cannot
be responsible for a deadlock. It's something in your code.
Check what that function is waiting on (mutex or some such)
and see what other blocked thread holds the mutex (or whatever)
while waiting on something else.
BTW, if your server is free-threaded, and you never create
STAs in it, you don't need GIT. Just an observation, not
related to your deadlock...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Aaron Smith" <AaronSmith@somewhere.com> wrote in message
news:etWSU$gwGHA.1888@TK2MSFTNGP03.phx.gbl...
I've been working on an "Audio Router" for the last couple of years.
Its been in production code for the last year. Now all of a sudden we
are starting to see deadlocks. I was most definitely a beginner when I
started the project and still have a lot to learn.
The Audio Router is implemented as an out of process COM server,
singleton (using DECLARE_CLASSFACTORY_SINGLETON) using MTA thread model.
I had to make this a singleton so multiple clients can have access to
the microphone and sound buffers. The clients control the
publish/subscribe states for audio to multiple DirectPlay groups my
making calls on the Audio Router. As specific events happen (received
from a DirectPlay message handler) callbacks are made to the clients
through a provided callback interface (the callback interfaces are
stored in a global interface table). When things reach a deadlock
state, I can step into the debugger and see that several threads are
stopped while invoking a function on Audio Router (some threads start
from the DirectPlay callback, others start from clients calling into
Audio Router).
With that said, I have to assume that this is an issue of making Audio
Router a singleton. I have seen allot about not using singletons, but
that it could be done using an EXE COM Server... if done properly. Can
anyone point me to a resource that would explain the "done properly"
part. I've also read that singletons are not necessary if you use static
or global member variables. Will this work if I create a "Audio Router
Factory" (not an actual COM factory) that wraps a static pointer to the
Audio Router interface. Then provide a "get interface" method to return
the interface properly marshaled for the calling thread?
Thanks in advance,
Aaron Smith