Drop usage of Boost Thread for the macosx target and remove ORO_OS_USE_BOOST_THREAD #310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #53 (comment):
Boost.Thread was used to implement mutexes and condition variables for the macOS target (
macosx
). The main reason for this was that Apple's implementation ofpthread_mutex_t
does not havepthread_mutex_timedlock
. Workaround: Pair the mutex with a condition variable that is signaled whenever the mutex is unlocked. This is also howboost::timed_mutex
is implemented for the caseBOOST_THREAD_USES_PTHREAD_TIMEDLOCK
is not defined (cf. https://github.com/boostorg/thread/blob/boost-1.62.0/include/boost/thread/pthread/mutex.hpp#L181).TLSF still uses
pthread_mutex_t
directly for efficiency.There was also a bug in TLSF 2.4.6 that was fixed in 3ffcc5e:
The calculation of the maximum size of the area in
init_memory_pool()
was wrong for certain combinations ofmem_size_pool
andsizeof(tlsf_t)
, where. This caused an invalid write after the pool in
process_area()
.Example:
The fix is to add another
ROUNDUP_SIZE()
macro call in the second summand: