File indexing completed on 2026-08-20 09:00:44
0001 #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
0002 #define BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
0003
0004
0005
0006 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
0007 # pragma once
0008 #endif
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include <thread>
0025 #include <exception>
0026
0027 namespace boost
0028 {
0029 namespace detail
0030 {
0031
0032 using lw_thread_t = std::thread*;
0033
0034 template<class F> int lw_thread_create( lw_thread_t& th, F f )
0035 {
0036 try
0037 {
0038 th = new std::thread( f );
0039 return 0;
0040 }
0041 catch( std::exception const& )
0042 {
0043 return -1;
0044 }
0045 }
0046
0047 void lw_thread_join( lw_thread_t th )
0048 {
0049 th->join();
0050 delete th;
0051 }
0052
0053 }
0054 }
0055
0056 #endif