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)
18 int32_t *bin = queue->read_fetch();
19 printf("Read: %d\n", load_32(bin));
20 queue->read_consume();
23 int user_main(int argc, char **argv)
25 struct mpmc_boundq_1_alt<int32_t, sizeof(int32_t)> queue;
28 int32_t *bin = queue.write_prepare();
30 queue.write_publish();
32 printf("Start threads\n");
34 thrd_create(&A, (thrd_start_t)&threadA, &queue);
35 thrd_create(&B, (thrd_start_t)&threadB, &queue);
39 printf("Threads complete\n");