Skip to content

Commit

Permalink
Merge branch 'vulkan-rhi' of https://github.com/bobcao3/taichi into v…
Browse files Browse the repository at this point in the history
…ulkan-rhi
  • Loading branch information
bobcao3 committed Dec 18, 2022
2 parents 8a82023 + fd4cd4b commit 9ff758b
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 @@ -96,12 +96,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 @@ -114,14 +114,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 9ff758b

Please sign in to comment.