Boost logo

Boost Users :

Subject: [Boost-users] threads in a DLL with callbacks
From: Nicholas Cain (ncain_at_[hidden])
Date: 2008-09-25 05:55:42


Hi,

I've created a component that's distributed as a DLL. The user loads the
DLL, calls various methods on it and gets some data back asyncronously via
callbacks.

Within the component there are several threads (using boost threads of
course) any of which might call the callbacks. In all our sample code
demonstrating how to create callbacks and call the methods we use boost
mutexes to protect the callback functions and this works just fine.

Some of our clients however don't want to dip their toes into boost, and
want to use windows methods to protect the callbacks. For instance so far
they've tried various methods such as CComAutoCriticalSection and
EnterCriticalSection.

They still have a crash which they're attributing to my DLL. I keep pushing
them to at least try the boost mutex as in our sample code, but no luck so
far.

My question is; should the windows critical section protect the callbacks
just as well as the boost mutexes, or does it require a boost mutex
protection? (or do you require a code example to know the answer to this?)

Nik


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net