fifo -> queue

This commit is contained in:
jacekpoz 2024-03-10 14:03:59 +01:00
parent a877419d69
commit 8ef8ad7ddb
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -13,21 +13,21 @@ int main(void) {
long val = rand() % 1000;
printf("%zu: writing %ld to queue...\n", i, val);
if (queue_write(q, &val)) {
printf("%zu: successfully wrote %ld to fifo!\n", i, val);
printf("%zu: successfully wrote %ld to queue!\n", i, val);
} else {
printf("%zu: failed writing %ld to fifo :-(\n", i, val);
printf("%zu: failed writing %ld to queue :-(\n", i, val);
}
}
for (size_t i = 0; i < 50; ++i) {
void *val_ptr = queue_read(q);
if (val_ptr == NULL) {
printf("%zu: fifo is empty!\n", i);
printf("%zu: queue is empty!\n", i);
break;
}
long val = *(long*)val_ptr;
printf("%zu: read %ld from fifo\n", i, val);
printf("%zu: read %ld from queue\n", i, val);
free(val_ptr);
}