Skip to content

Commit

Permalink
Remove std::mutex() from list-initialization (#355)
Browse files Browse the repository at this point in the history
Remove the `std::mutex()` constructor call from list-initialization in `ucxx::Endpoint`. This is totally unnecessary and may cause issues with some compilers (or compiler options):

```
...
error: function "std::mutex::mutex(const std::mutex &)" (declared at line 94 of /opt/conda/envs/base/lib/gcc/x86_64-conda-linux-gnu/11.4.0/include/c++/bits/std_mutex.h) cannot be referenced -- it is a deleted function
```

Authors:
  - Peter Andreas Entschev (https://github.com/pentschev)

Approvers:
  - Sebastian Berg (https://github.com/seberg)
  - Mads R. B. Kristensen (https://github.com/madsbk)

URL: #355
  • Loading branch information
pentschev authored Jan 27, 2025
1 parent b685d4e commit 3542f03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cpp/include/ucxx/endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class Endpoint : public Component {
bool _endpointErrorHandling{true}; ///< Whether the endpoint enables error handling
std::unique_ptr<InflightRequests> _inflightRequests{
std::make_unique<InflightRequests>()}; ///< The inflight requests
std::mutex _mutex{std::mutex()}; ///< Mutex used during close to prevent race conditions between
///< application thread and `ucxx::Endpoint::setCloseCallback()`
///< that may run asynchronously on another thread.
std::mutex _mutex{}; ///< Mutex used during close to prevent race conditions between
///< application thread and `ucxx::Endpoint::setCloseCallback()`
///< that may run asynchronously on another thread.
ucs_status_t _status{UCS_INPROGRESS}; ///< Endpoint status
std::atomic<bool> _closing{false}; ///< Prevent calling close multiple concurrent times.
EndpointCloseCallbackUserFunction _closeCallback{nullptr}; ///< Close callback to call
Expand Down

0 comments on commit 3542f03

Please sign in to comment.