Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Using and building the library

Configuration
Boost.Chrono
Boost.Move
Boost.DateTime
Boost.Atomic
boost::thread::operator== deprecated
boost::condition deprecated
Mutex nested lock types deprecated
thread::id
Shared Locking Generic
Shared Locking Upwards Conversion
Explicit Lock Conversion
unique_future versus future
promise lazy initialization
promise Allocator constructor
Call to terminate if joinable
once_flag
Signature parameter for packaged_task
-var thread constructor with variadic rvalue parameters
future<>::get() invalidates the future
Interruptions
Version
Limitations
SunPro
VACPP
WCE

Boost.Thread is configured following the conventions used to build libraries with separate source code. Boost.Thread will import/export the code only if the user has specifically asked for it, by defining either BOOST_ALL_DYN_LINK if they want all boost libraries to be dynamically linked, or BOOST_THREAD_DYN_LINK if they want just this one to be dynamically liked.

The definition of these macros determines whether BOOST_THREAD_USE_DLL is defined. If BOOST_THREAD_USE_DLL is not defined, the library will define BOOST_THREAD_USE_DLL or BOOST_THREAD_USE_LIB depending on whether the platform. On non windows platforms BOOST_THREAD_USE_LIB is defined if is not defined. In windows platforms, BOOST_THREAD_USE_LIB is defined if BOOST_THREAD_USE_DLL and the compiler supports auto-tss cleanup with Boost.Threads (for the time been Msvc and Intel)

The source code compiled when building the library defines a macros BOOST_THREAD_SOURCE that is used to import or export it. The user must not define this macro in any case.

Boost.Thread depends on some non header-only libraries.

It seems that there are some IDE (as e.g. Visual Studio) that deduce the libraries that a program needs to link to inspecting the sources. Such IDE could force to link to Boost.DateTime and/or Boost.Chrono.

As the single mandatory dependency is to Boost.System, the following

bjam toolset=msvc-11.0 --build-type=complete --with-thread

will install only boost_thread and boost_system.

Users of such IDE should force the Boost.Chrono and Boost.DateTime build using

bjam toolset=msvc-11.0 --build-type=complete --with-thread --with-chrono --with-date_time

The following section describes all the macros used to configure Boost.Thread.


PrevUpHomeNext