Boost logo

Boost Users :

Subject: Re: [Boost-users] Thread not interrupted in runtime linked library
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2010-01-07 12:41:42

"Lloyd" <lloyd_at_[hidden]> writes:

> Using boost thread a new thread is created. The thread loads a DLL using
> LoadLibrary() call, gets the procedure address by calling GetProcAddress() and
> executes the procedure. The body of procedure is an infinite loop. When I try
> to interrupt the thread from main thread it is not interrrupted! What could be
> the reason? In all other cases the thread is interrupted except when it is
> inside the dynamically (runtime) linked library procedure. What could be the
> reason? Please share some idea...

For this to work both the loaded DLL and the main app must use the DLL
version of boost.thread. Otherwise, they have separate versions of the
internal data structures used for interruption, so the code in the DLL
will check the wrong flag and won't see the interruption status as set
by the main app.


Author of C++ Concurrency in Action
just::thread C++0x thread library   
Just Software Solutions Ltd
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at