Skip to content

Commit

Permalink
fix: fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dranikpg committed Jan 22, 2024
1 parent c39414d commit 3f82065
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/server/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,17 @@ class Transaction {
};

// Barrier akin to helio's BlockingCounter, but with phase counting and proper acquire semantics
// for polling work from other threads. And without keap allocation.
struct PhasedBarrier {
// for polling work from other threads. And without heap allocation.
class PhasedBarrier {
public:
uint32_t Start(uint32_t count); // Release: Store count, return current phase
bool Active() const; // Acquire: Return if count > 0. Use for polling for work

void Dec(Transaction* keep_alive); // Relase: Decrease count, notify ec on 0
void Wait(); // Acquire: Wait until count = 0, increment phase

bool IsMyPhase(uint32_t phase) const; // Return if same phase. Assumes called after Active().
uint32_t DEBUG_Get() const;
uint32_t DEBUG_Get() const; // Get current counter value

private:
std::atomic_uint32_t phase_{0};
Expand Down Expand Up @@ -589,7 +590,7 @@ class Transaction {
DbIndex db_index_{0};
uint64_t time_now_ms_{0};

std::atomic_uint32_t use_count_{0}; // transaction exists only as a shared pointer (intrusive)
std::atomic_uint32_t use_count_{0}; // transaction exists only as an intrusive_ptr

uint32_t unique_shard_cnt_{0}; // Number of unique shards active
ShardId unique_shard_id_{kInvalidSid}; // Set if unique_shard_cnt_ = 1
Expand Down

0 comments on commit 3f82065

Please sign in to comment.