mirror of
https://github.com/tstack/lnav
synced 2024-11-17 15:29:40 +00:00
parent
eda33d696d
commit
05f9eaf74a
@ -182,6 +182,15 @@ operator-(const struct timeval& lhs, const struct timeval& rhs)
|
||||
return diff;
|
||||
}
|
||||
|
||||
inline struct timeval
|
||||
operator+(const struct timeval& lhs, const struct timeval& rhs)
|
||||
{
|
||||
struct timeval retval;
|
||||
|
||||
timeradd(&lhs, &rhs, &retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
typedef int64_t mstime_t;
|
||||
|
||||
inline mstime_t
|
||||
|
@ -736,7 +736,7 @@ execute_any(exec_context& ec, const std::string& cmdline_with_mode)
|
||||
(lnav_data.ld_flags & LNF_HEADLESS || ec.ec_path_stack.size() > 1))
|
||||
{
|
||||
rescan_files();
|
||||
wait_for_pipers();
|
||||
wait_for_pipers(nonstd::nullopt);
|
||||
rebuild_indexes_repeatedly();
|
||||
}
|
||||
});
|
||||
@ -833,7 +833,11 @@ execute_init_commands(
|
||||
}
|
||||
|
||||
rescan_files();
|
||||
wait_for_pipers();
|
||||
auto deadline = current_timeval()
|
||||
+ ((lnav_data.ld_flags & LNF_HEADLESS)
|
||||
? timeval{5, 0}
|
||||
: timeval{0, 500000});
|
||||
wait_for_pipers(deadline);
|
||||
rebuild_indexes_repeatedly();
|
||||
}
|
||||
if (dls.dls_rows.size() > 1 && lnav_data.ld_view_stack.size() == 1)
|
||||
|
@ -1005,7 +1005,7 @@ gather_pipers()
|
||||
}
|
||||
|
||||
void
|
||||
wait_for_pipers()
|
||||
wait_for_pipers(nonstd::optional<timeval> deadline)
|
||||
{
|
||||
static const auto MAX_SLEEP_TIME = std::chrono::milliseconds(300);
|
||||
auto sleep_time = std::chrono::milliseconds(10);
|
||||
@ -1017,6 +1017,9 @@ wait_for_pipers()
|
||||
log_debug("all pipers finished");
|
||||
break;
|
||||
}
|
||||
if (deadline && (deadline.value() < current_timeval())) {
|
||||
break;
|
||||
}
|
||||
// Use usleep() since it is defined to be interruptable by a signal.
|
||||
auto urc = usleep(
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(sleep_time)
|
||||
|
@ -283,6 +283,6 @@ extern const ssize_t ZOOM_COUNT;
|
||||
|
||||
bool setup_logline_table(exec_context& ec);
|
||||
void wait_for_children();
|
||||
void wait_for_pipers();
|
||||
void wait_for_pipers(nonstd::optional<timeval> deadline = nonstd::nullopt);
|
||||
|
||||
#endif
|
||||
|
@ -70,7 +70,7 @@ rebuild_indexes_repeatedly()
|
||||
}
|
||||
|
||||
void
|
||||
wait_for_pipers()
|
||||
wait_for_pipers(nonstd::optional<timeval>)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user