Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 17, 2022
1 parent 72682a1 commit fd4cd4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions taichi/rhi/impl_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ struct BidirMap {
template <class T>
class SyncedPtrStableObjectList {
using storage_block = std::array<uint8_t, sizeof(T)>;

public:
template <typename... Params>
T &acquire(Params &&...args) {
std::lock_guard<std::mutex> _(lock_);

void *storage = nullptr;
if (free_nodes_.empty()) {
storage = objects_.emplace_front().data();
Expand All @@ -113,14 +113,14 @@ class SyncedPtrStableObjectList {

void release(T *ptr) {
std::lock_guard<std::mutex> _(lock_);

ptr->~T();
free_nodes_.push_back(ptr);
}

void clear() {
std::lock_guard<std::mutex> _(lock_);

// Transfer to quick look-up
std::unordered_set<void *> free_nodes_set(free_nodes_.begin(),
free_nodes_.end());
Expand Down

0 comments on commit fd4cd4b

Please sign in to comment.