7 #include "mpmc-queue.h"
9 void threadA(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
11 int32_t *bin = queue->write_prepare();
13 queue->write_publish();
16 void threadB(struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> *queue)
19 while (bin = queue->read_fetch()) {
20 printf("Read: %d\n", load_32(bin));
21 queue->read_consume();
25 int user_main(int argc, char **argv)
27 struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> queue;
30 int32_t *bin = queue.write_prepare();
32 queue.write_publish();
34 printf("Start threads\n");
36 thrd_create(&A, (thrd_start_t)&threadA, &queue);
37 thrd_create(&B, (thrd_start_t)&threadB, &queue);
41 printf("Threads complete\n");