mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-04-19 16:20:54 +00:00
Logic may be clearer this way
This commit is contained in:
parent
e846b11ce7
commit
c6d2988485
21
geojson.c
21
geojson.c
@ -1721,11 +1721,11 @@ int read_json(int argc, struct source **sourcelist, char *fname, const char *lay
|
||||
ahead += n;
|
||||
|
||||
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.
|
||||
// If the buffered input gets huge, block until the parsers are done.
|
||||
while (ahead >= PARSE_MAX && is_parsing != 0) {
|
||||
// If the buffered input gets huge, even if the parsers are still running,
|
||||
// wait for the parser thread instead of continuing to stream input.
|
||||
|
||||
if (is_parsing == 0 || ahead >= PARSE_MAX) {
|
||||
if (initial_offset != 0) {
|
||||
if (pthread_join(parallel_parser, NULL) != 0) {
|
||||
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);
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user