Add some more control to the ring buffer.
This commit is contained in:
@ -42,7 +42,7 @@ void *write_function(void *arg)
|
||||
int fd = open(data->path, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Writer thread error: Can't open file");
|
||||
iso_ring_buffer_writer_close(data->rbuf);
|
||||
iso_ring_buffer_writer_close(data->rbuf, 1);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ void *write_function(void *arg)
|
||||
fprintf(stderr, "Writer finish: %d\n", res);
|
||||
|
||||
close(fd);
|
||||
iso_ring_buffer_writer_close(data->rbuf);
|
||||
iso_ring_buffer_writer_close(data->rbuf, 0);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ void *read_function(void *arg)
|
||||
}
|
||||
fprintf(stderr, "Reader finish: %d\n", res);
|
||||
|
||||
iso_ring_buffer_reader_close(data->rbuf);
|
||||
iso_ring_buffer_reader_close(data->rbuf, 0);
|
||||
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
@ -105,7 +105,7 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
res = iso_ring_buffer_new(&data.rbuf);
|
||||
res = iso_ring_buffer_new(1024, &data.rbuf);
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Can't create buffer\n");
|
||||
return 1;
|
||||
|
@ -72,7 +72,8 @@ int main(int argc, char **argv)
|
||||
NULL, /* output charset */
|
||||
0, /* appendable */
|
||||
0, /* ms_block */
|
||||
NULL /* overwrite */
|
||||
NULL, /* overwrite */
|
||||
1024 /* fifo_size */
|
||||
};
|
||||
|
||||
while ((c = getopt(argc, argv, optstring)) != -1) {
|
||||
|
@ -55,7 +55,8 @@ int main(int argc, char **argv)
|
||||
NULL, /* output charset */
|
||||
0, /* appendable */
|
||||
0, /* ms_block */
|
||||
NULL /* overwrite */
|
||||
NULL, /* overwrite */
|
||||
1024 /* fifo_size */
|
||||
};
|
||||
struct iso_read_opts ropts = {
|
||||
0, /* block */
|
||||
|
@ -50,7 +50,8 @@ int main(int argc, char **argv)
|
||||
NULL, /* output charset */
|
||||
0, /* appendable */
|
||||
0, /* ms_block */
|
||||
NULL /* overwrite */
|
||||
NULL, /* overwrite */
|
||||
1024 /* fifo_size */
|
||||
};
|
||||
struct iso_read_opts ropts = {
|
||||
0, /* block */
|
||||
|
@ -50,7 +50,8 @@ int main(int argc, char **argv)
|
||||
NULL, /* output charset */
|
||||
0, /* appendable */
|
||||
0, /* ms_block */
|
||||
NULL /* overwrite */
|
||||
NULL, /* overwrite */
|
||||
1024 /* fifo_size */
|
||||
};
|
||||
struct iso_read_opts ropts = {
|
||||
0, /* block */
|
||||
|
Reference in New Issue
Block a user