5 #include "mpmc-queue.h"
9 void threadA(struct mpmc_boundq_1_alt<int32_t> *queue)
11 int32_t *bin = write_prepare(queue);
13 write_publish(queue, bin);
16 void threadB(struct mpmc_boundq_1_alt<int32_t> *queue)
19 if ((bin = read_fetch(queue)) != NULL) {
20 //printf("Read: %d\n", load_32(bin));
21 read_consume(queue, bin);
25 void threadC(struct mpmc_boundq_1_alt<int32_t> *queue)
27 int32_t *bin = write_prepare(queue);
29 write_publish(queue, bin);
31 while ((bin = read_fetch(queue)) != NULL) {
32 //printf("Read: %d\n", load_32(bin));
33 read_consume(queue, bin);
38 int user_main(int argc, char **argv)
40 mpmc_boundq_1_alt<int32_t> *queue = createMPMC(2);
44 printf("Start threads\n");
46 thrd_create(&A, (thrd_start_t)&threadA, queue);
47 thrd_create(&B, (thrd_start_t)&threadB, queue);
48 //thrd_create(&C, (thrd_start_t)&threadC, queue);
54 printf("Threads complete\n");