mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Logic may be clearer this way
This commit is contained in:
@@ -1721,11 +1721,11 @@ int read_json(int argc, struct source **sourcelist, char *fname, const char *lay
|
|||||||
ahead += n;
|
ahead += n;
|
||||||
|
|
||||||
if (buf[n - 1] == '\n' && ahead > PARSE_MIN) {
|
if (buf[n - 1] == '\n' && ahead > PARSE_MIN) {
|
||||||
int already_waited = 0;
|
|
||||||
|
|
||||||
// Don't let the streaming reader get too far ahead of the parsers.
|
// Don't let the streaming reader get too far ahead of the parsers.
|
||||||
// If the buffered input gets huge, block until the parsers are done.
|
// If the buffered input gets huge, even if the parsers are still running,
|
||||||
while (ahead >= PARSE_MAX && is_parsing != 0) {
|
// wait for the parser thread instead of continuing to stream input.
|
||||||
|
|
||||||
|
if (is_parsing == 0 || ahead >= PARSE_MAX) {
|
||||||
if (initial_offset != 0) {
|
if (initial_offset != 0) {
|
||||||
if (pthread_join(parallel_parser, NULL) != 0) {
|
if (pthread_join(parallel_parser, NULL) != 0) {
|
||||||
perror("pthread_join");
|
perror("pthread_join");
|
||||||
@@ -1733,19 +1733,6 @@ int read_json(int argc, struct source **sourcelist, char *fname, const char *lay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
already_waited = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_parsing == 0) {
|
|
||||||
if (!already_waited) {
|
|
||||||
if (initial_offset != 0) {
|
|
||||||
if (pthread_join(parallel_parser, NULL) != 0) {
|
|
||||||
perror("pthread_join");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fflush(readfp);
|
fflush(readfp);
|
||||||
start_parsing(readfd, readfp, initial_offset, ahead, &is_parsing, ¶llel_parser, reading, reader, &progress_seq, exclude, include, exclude_all, fname, basezoom, source, nlayers, droprate, initialized, initial_x, initial_y);
|
start_parsing(readfd, readfp, initial_offset, ahead, &is_parsing, ¶llel_parser, reading, reader, &progress_seq, exclude, include, exclude_all, fname, basezoom, source, nlayers, droprate, initialized, initial_x, initial_y);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user