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

Commit

Permalink
Minor code improvement in verify-spsc
Browse files Browse the repository at this point in the history
Signed-off-by: Diogo Behrens <diogo.behrens@huawei.com>
  • Loading branch information
db7 committed Apr 27, 2024
1 parent 2e9e64d commit 424919a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/verify-spsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@
#include <vsync/atomic.h>
#include <vsync/common/await_while.h>

/* ring buffer selection */
//#include "ringbuf.h"
//#include "ringbuf_spsc_plain.h"
//#include "ringbuf_spsc_volatile.h"
//#include "ringbuf_spsc_rlx.h"
//#include "ringbuf_spsc_sc.h"
#include "ringbuf_spsc.h"
#include "ringbuf.h"

#define RBUF_SIZE 2
#define VALUES 3
Expand All @@ -37,7 +31,7 @@ void* producer(void* arg)

for (int i = 0; i < VALUES; i++) {
struct data* d = &data_items[i];
d->sent = 1;
d->sent = true;
await_while(ringbuf_enq(&rb, d) != RINGBUF_OK);
}
return 0;
Expand Down Expand Up @@ -68,7 +62,7 @@ int main(void)
pthread_join(tc, 0);

for (int i = 0; i < TOTAL; i++)
assert(data_items[i].sent == 1 && data_items[i].recv == 1);
assert(data_items[i].sent && data_items[i].recv);

return 0;
}

0 comments on commit 424919a

Please sign in to comment.