regressions/ck_fifo: Add coverage for deinit routines.

ck_pring
Samy Al Bahra 11 years ago
parent 5ec8191ded
commit ca49839883

@ -117,6 +117,7 @@ main(int argc, char *argv[])
{
int i, r;
struct context *context;
ck_fifo_mpmc_entry_t *garbage;
pthread_t *thread;
if (argc != 4) {
@ -139,6 +140,10 @@ main(int argc, char *argv[])
assert(thread);
ck_fifo_mpmc_init(&fifo, malloc(sizeof(ck_fifo_mpmc_entry_t)));
ck_fifo_mpmc_deinit(&fifo, &garbage);
free(garbage);
ck_fifo_mpmc_init(&fifo, malloc(sizeof(ck_fifo_mpmc_entry_t)));
for (i = 0; i < nthr; i++) {
context[i].tid = i;
r = pthread_create(thread + i, NULL, test, context + i);

@ -144,6 +144,8 @@ main(int argc, char *argv[])
assert(thread);
for (i = 0; i < nthr; i++) {
ck_fifo_spsc_entry_t *garbage;
context[i].tid = i;
if (i == 0) {
context[i].previous = nthr - 1;
@ -156,6 +158,9 @@ main(int argc, char *argv[])
context[i].previous = i - 1;
}
ck_fifo_spsc_init(fifo + i, malloc(sizeof(ck_fifo_spsc_entry_t)));
ck_fifo_spsc_deinit(fifo + i, &garbage);
free(garbage);
ck_fifo_spsc_init(fifo + i, malloc(sizeof(ck_fifo_spsc_entry_t)));
r = pthread_create(thread + i, NULL, test, context + i);
assert(r == 0);
@ -166,3 +171,4 @@ main(int argc, char *argv[])
return (0);
}

Loading…
Cancel
Save