regressions/ck_fifo: Add test for try{enqueue,dequeue} API.

ck_pring
Samy Al Bahra 13 years ago
parent 816e11ff61
commit a90b402c0c

@ -92,6 +92,24 @@ test(void *c)
} }
} }
} }
for (i = 0; i < ITERATIONS; i++) {
for (j = 0; j < size; j++) {
fifo_entry = malloc(sizeof(ck_fifo_mpmc_entry_t));
entry = malloc(sizeof(struct entry));
entry->tid = context->tid;
while (ck_fifo_mpmc_tryenqueue(&fifo, fifo_entry, entry) == false)
ck_pr_stall();
while (ck_fifo_mpmc_trydequeue(&fifo, &entry, &garbage) == false)
ck_pr_stall();
if (entry->tid < 0 || entry->tid >= nthr) {
fprintf(stderr, "ERROR [%u] Incorrect value in entry when using try interface.\n", entry->tid);
exit(EXIT_FAILURE);
}
}
}
#endif #endif
return (NULL); return (NULL);

Loading…
Cancel
Save