Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #462 from MathieuBordere/init-barrier
Browse files Browse the repository at this point in the history
uv_append: Initialize barrier upon creation.
  • Loading branch information
Mathieu Borderé authored Jul 27, 2023
2 parents 64d3503 + 36c2388 commit 8ba37b3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/uv_append.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,13 +790,14 @@ static void uvBarrierTriggerAll(struct UvBarrier *barrier)
}
}

struct UvBarrier *uvBarrierAlloc(void)
static struct UvBarrier *uvBarrierCreate(void)
{
struct UvBarrier *barrier;
barrier = RaftHeapMalloc(sizeof(*barrier));
barrier = RaftHeapCalloc(1, sizeof(*barrier));
if (!barrier) {
return NULL;
}
barrier->blocking = false;
QUEUE_INIT(&barrier->reqs);
return barrier;
}
Expand Down Expand Up @@ -829,7 +830,7 @@ int UvBarrier(struct uv *uv, raft_index next_index, struct UvBarrierReq *req)
}

if (!barrier) {
barrier = uvBarrierAlloc();
barrier = uvBarrierCreate();
if (!barrier) {
return RAFT_NOMEM;
}
Expand All @@ -856,7 +857,7 @@ int UvBarrier(struct uv *uv, raft_index next_index, struct UvBarrierReq *req)
barrier = uv->barrier;
/* There is no uv->barrier, make new one. */
} else {
barrier = uvBarrierAlloc();
barrier = uvBarrierCreate();
if (!barrier) {
return RAFT_NOMEM;
}
Expand Down

0 comments on commit 8ba37b3

Please sign in to comment.