|
SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
|

Public Member Functions | |
| Dashboard () | |
| ~Dashboard () | |
| void | update (const std::list< ProgressInfo > &info) |
Private Member Functions | |
| void | uiThread () |
| void | handleSignal (const struct pollfd &poll_fd, LogWidget &logWidget) |
| void | pipeToLog (const struct pollfd &poll_fd, int pipe, LogWidget &out) const |
| void | handleKeyPress (const struct pollfd &poll_fd, LogWidget &logWidget) const |
| void | ncursesMode () |
Private Attributes | |
| std::unique_ptr< boost::thread > | m_ui_thread |
| std::list< ProgressInfo > | m_progress_info |
| std::mutex | m_progress_info_mutex |
| int | m_stderr_original |
| int | m_stderr_pipe |
| FILE * | m_stderr |
| int | m_stdout_original |
| int | m_stdout_pipe |
| std::vector< std::string > | m_log_text |
| std::atomic_bool | m_trigger_resize {false} |
| std::atomic_bool | m_exit_loop {false} |
The Dashboard wraps the UI screen, which runs on an independent thread to avoid race conditions.
ncurses calls are not thread safe, so it is better to contain them within a single thread. Normally, ncurses does a proper setup of signal handling (i.e. SIGINT), so the terminal is returned into its proper state. However, we want to re-print the output after exiting the curses mode, so we need to handle the signals ourselves: catch, exit ncurses, dump log, and delegate to the previously installed handler.
Definition at line 688 of file ProgressNCurses.cpp.
|
inline |
Constructor
Definition at line 842 of file ProgressNCurses.cpp.
References std::bind(), std::generic_category(), SourceXtractor::interceptFileDescriptor(), m_stderr, m_stderr_original, m_stderr_pipe, m_stdout_original, m_stdout_pipe, m_ui_thread, Euclid::make_unique(), and uiThread().

|
inline |
Destructor Notifies the UI thread to finish and clean up, and recover stdout and stderr
Definition at line 857 of file ProgressNCurses.cpp.
References std::fclose(), m_stderr, m_stderr_original, m_stderr_pipe, m_stdout_original, m_stdout_pipe, and m_ui_thread.

|
inlineprivate |
Definition at line 761 of file ProgressNCurses.cpp.
References SourceXtractor::LogWidget::handleKeyPress().
Referenced by ncursesMode().

|
inlineprivate |
Definition at line 734 of file ProgressNCurses.cpp.
References m_exit_loop, m_trigger_resize, SourceXtractor::signal_fds, std::snprintf(), and SourceXtractor::LogWidget::write().
Referenced by ncursesMode().

|
inlineprivate |
When we enter we are in ncurses, when we exit we are not (yay RAII)
Definition at line 773 of file ProgressNCurses.cpp.
References SourceXtractor::ProgressWidget::getHeight(), SourceXtractor::LogWidget::getText(), handleKeyPress(), handleSignal(), SourceXtractor::Screen::initColor(), m_exit_loop, m_log_text, m_progress_info, m_progress_info_mutex, m_stderr, m_stderr_pipe, m_stdout_pipe, m_trigger_resize, SourceXtractor::ProgressWidget::move(), pipeToLog(), SourceXtractor::LogWidget::resize(), SourceXtractor::ProgressWidget::resize(), SourceXtractor::signal_fds, and SourceXtractor::ProgressWidget::update().
Referenced by uiThread().

|
inlineprivate |
Definition at line 751 of file ProgressNCurses.cpp.
References SourceXtractor::LogWidget::write().
Referenced by ncursesMode().

|
inlineprivate |
Main UI thread. All (almost) ncurses handling should be done here, as it is not thread safe
Definition at line 711 of file ProgressNCurses.cpp.
References std::endl(), m_log_text, m_stderr_original, m_stdout_original, SourceXtractor::ncurses_done, and ncursesMode().
Referenced by Dashboard().

|
inline |
Update the progress information
Definition at line 880 of file ProgressNCurses.cpp.
References m_progress_info, m_progress_info_mutex, m_trigger_resize, and std::list< T >::size().

|
private |
Definition at line 706 of file ProgressNCurses.cpp.
Referenced by handleSignal(), and ncursesMode().
|
private |
Definition at line 703 of file ProgressNCurses.cpp.
Referenced by ncursesMode(), and uiThread().
|
private |
Definition at line 691 of file ProgressNCurses.cpp.
Referenced by ncursesMode(), and update().
|
private |
Definition at line 692 of file ProgressNCurses.cpp.
Referenced by ncursesMode(), and update().
|
private |
Definition at line 697 of file ProgressNCurses.cpp.
Referenced by Dashboard(), ncursesMode(), and ~Dashboard().
|
private |
Definition at line 695 of file ProgressNCurses.cpp.
Referenced by Dashboard(), uiThread(), and ~Dashboard().
|
private |
Definition at line 696 of file ProgressNCurses.cpp.
Referenced by Dashboard(), ncursesMode(), and ~Dashboard().
|
private |
Definition at line 699 of file ProgressNCurses.cpp.
Referenced by Dashboard(), uiThread(), and ~Dashboard().
|
private |
Definition at line 700 of file ProgressNCurses.cpp.
Referenced by Dashboard(), ncursesMode(), and ~Dashboard().
|
private |
Definition at line 705 of file ProgressNCurses.cpp.
Referenced by handleSignal(), ncursesMode(), and update().
|
private |
Definition at line 690 of file ProgressNCurses.cpp.
Referenced by Dashboard(), and ~Dashboard().