Commit 2cc43777 authored by Dominik Charousset's avatar Dominik Charousset

Merge branch 'topic/logger', close #804

parents 0f1831cd 4b4b782d
...@@ -416,37 +416,3 @@ else ...@@ -416,37 +416,3 @@ else
configure "$compiler" "" "$bindir" "$libdir" "$CMakeGenerator" configure "$compiler" "" "$bindir" "$libdir" "$CMakeGenerator"
fi fi
if [ -n "$CMakeGenerator" ] && [ "$CMakeGenerator" != "Unix" ]; then
# skip Makefile-specific code below when not using make
exit 0
fi
printf "DIRS := %s\n\n" "$workdirs" > $sourcedir/Makefile
makefile=`cat <<'EOT'
all:
@for i in $(DIRS); do $(MAKE) -C $$i $@ || exit; done
test:
@for i in $(DIRS); do $(MAKE) -C $$i $@ || exit; done
install:
@for i in $(DIRS); do $(MAKE) -C $$i $@ || exit; done
uninstall:
@for i in $(DIRS); do $(MAKE) -C $$i $@ || exit; done
clean:
@for i in $(DIRS); do $(MAKE) -C $$i $@; done
distclean:
rm -rf $(DIRS) Makefile
doc:
$(MAKE) -C $(firstword $(DIRS)) $@
.PHONY: all test install uninstall clean distclean doc
EOT
`
echo "$makefile" >> $sourcedir/Makefile
...@@ -547,16 +547,24 @@ string_view logger::skip_path(string_view path) { ...@@ -547,16 +547,24 @@ string_view logger::skip_path(string_view path) {
} }
void logger::run() { void logger::run() {
// Bail out without printing anything if the first event we receive is the
// shutdown (empty) event.
queue_.wait_nonempty();
if (queue_.front().message.empty())
return;
log_first_line(); log_first_line();
// Loop until receiving an empty message.
for (;;) { for (;;) {
queue_.wait_nonempty(); // Handle current head of the queue.
auto& e = queue_.front(); auto& e = queue_.front();
if (e.message.empty()) { if (e.message.empty()) {
log_last_line(); log_last_line();
return; return;
} }
handle_event(e); handle_event(e);
// Prepare next iteration.
queue_.pop_front(); queue_.pop_front();
queue_.wait_nonempty();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment