Skip to content

Commit 409c98f

Browse files
authored
Merge pull request #317 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2 parents 5732965 + f5bf095 commit 409c98f

4 files changed

Lines changed: 57 additions & 2 deletions

File tree

include/boost/thread/detail/config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
#define BOOST_THREAD_FUTURE_USES_OPTIONAL
406406
#endif
407407

408-
#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
408+
#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600)
409409
# pragma warn -8008 // Condition always true/false
410410
# pragma warn -8080 // Identifier declared but never used
411411
# pragma warn -8057 // Parameter never used

include/boost/thread/detail/thread.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ namespace boost
601601
class BOOST_SYMBOL_VISIBLE thread::id
602602
{
603603
private:
604+
605+
#if !defined(BOOST_EMBTC)
606+
604607
friend inline
605608
std::size_t
606609
hash_value(const thread::id &v)
@@ -612,6 +615,14 @@ namespace boost
612615
#endif
613616
}
614617

618+
#else
619+
620+
friend
621+
std::size_t
622+
hash_value(const thread::id &v);
623+
624+
#endif
625+
615626
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
616627
#if defined(BOOST_THREAD_PLATFORM_WIN32)
617628
typedef unsigned int data;
@@ -704,6 +715,21 @@ namespace boost
704715
#endif
705716
#endif
706717
};
718+
719+
#if defined(BOOST_EMBTC)
720+
721+
inline
722+
std::size_t
723+
hash_value(const thread::id &v)
724+
{
725+
#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
726+
return hash_value(v.thread_data);
727+
#else
728+
return hash_value(v.thread_data.get());
729+
#endif
730+
}
731+
732+
#endif
707733

708734
#ifdef BOOST_THREAD_PLATFORM_PTHREAD
709735
inline thread::id thread::get_id() const BOOST_NOEXCEPT

include/boost/thread/win32/thread_data.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ namespace boost
145145
{}
146146
virtual ~thread_data_base();
147147

148+
#if !defined(BOOST_EMBTC)
149+
148150
friend void intrusive_ptr_add_ref(thread_data_base * p)
149151
{
150152
BOOST_INTERLOCKED_INCREMENT(&p->count);
@@ -158,6 +160,13 @@ namespace boost
158160
}
159161
}
160162

163+
#else
164+
165+
friend void intrusive_ptr_add_ref(thread_data_base * p);
166+
friend void intrusive_ptr_release(thread_data_base * p);
167+
168+
#endif
169+
161170
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
162171
void interrupt()
163172
{
@@ -180,6 +189,24 @@ namespace boost
180189
}
181190
//#endif
182191
};
192+
193+
#if defined(BOOST_EMBTC)
194+
195+
inline void intrusive_ptr_add_ref(thread_data_base * p)
196+
{
197+
BOOST_INTERLOCKED_INCREMENT(&p->count);
198+
}
199+
200+
inline void intrusive_ptr_release(thread_data_base * p)
201+
{
202+
if(!BOOST_INTERLOCKED_DECREMENT(&p->count))
203+
{
204+
detail::heap_delete(p);
205+
}
206+
}
207+
208+
#endif
209+
183210
BOOST_THREAD_DECL thread_data_base* get_current_thread_data();
184211

185212
typedef boost::intrusive_ptr<detail::thread_data_base> thread_data_ptr;

src/win32/tss_dll.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
#include <windows.h>
1515

16-
#if defined(__BORLANDC__)
16+
#if defined(BOOST_BORLANDC)
1717
extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/)
18+
#elif defined(BOOST_EMBTC)
19+
extern "C" int _libmain(DWORD dwReason)
1820
#elif defined(_WIN32_WCE)
1921
extern "C" BOOL WINAPI DllMain(HANDLE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/)
2022
#else

0 commit comments

Comments
 (0)