boostorg / boostorg/thread

testable_mutex is broken

Open
#313 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
214
Forks
171
PR merge metrics
No merged PRs in 30d

Description

Currently, `testable_mutex` fails to compile because of this static assert:

```
../../../boost/thread/testable_mutex.hpp:39:24: required from here
../../../boost/atomic/detail/atomic_template.hpp:1097:83: error: static assertion failed: boost::atomic requires T to be a trivially copyable type
```

The problem is that `testable_mutex` uses `atomic` internally, and `thread::id` is indeed not trivially copyable. The trivially copyable requirement has always been there, but it was not enforced by Boost.Atomic until not long ago. Before, the code would compile, but user-defined copy constructor would not be called, which means `thread::id` could cause leak of `thread_data` if it used a smart pointer inside.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.