Boost logo

Boost Users :

Subject: Re: [Boost-users] threads in a DLL with callbacks
From: Nicholas Cain (ncain_at_[hidden])
Date: 2008-10-03 05:28:25

Hi, can I make another plea for any answers to my question (below). It may
be that the answer is so obviously 'of course it does' that I didn't get a
I did think about posting to the threads.devel list, but it didn't look like
the right place...


----- Original Message -----
From: "Nicholas Cain" <ncain_at_[hidden]>
To: <boost-users_at_[hidden]>
Sent: Thursday, September 25, 2008 10:55 AM
Subject: threads in a DLL with callbacks

> 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, kalb at, bjorn.karlsson at, gregod at, wekempf at