SourceXtractorPlusPlus
0.16
Please provide a description of the project.
|
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) |
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 |
std::atomic_bool | m_exit_loop |
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 673 of file ProgressNCurses.cpp.
|
inline |
Constructor
Definition at line 824 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, and uiThread().
|
inline |
Destructor Notifies the UI thread to finish and clean up, and recover stdout and stderr
Definition at line 839 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 743 of file ProgressNCurses.cpp.
References SourceXtractor::LogWidget::handleKeyPress().
Referenced by ncursesMode().
|
inlineprivate |
Definition at line 716 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 755 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 733 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 693 of file ProgressNCurses.cpp.
References std::endl(), m_log_text, SourceXtractor::ncurses_done::m_semaphore, m_stderr_original, m_stdout_original, and ncursesMode().
Referenced by Dashboard().
|
inline |
Update the progress information
Definition at line 862 of file ProgressNCurses.cpp.
References m_progress_info, m_progress_info_mutex, m_trigger_resize, and std::list< T >::size().
|
private |
Definition at line 688 of file ProgressNCurses.cpp.
Referenced by handleSignal(), and ncursesMode().
|
private |
Definition at line 686 of file ProgressNCurses.cpp.
Referenced by ncursesMode(), and uiThread().
|
private |
Definition at line 676 of file ProgressNCurses.cpp.
Referenced by ncursesMode(), and update().
|
private |
Definition at line 677 of file ProgressNCurses.cpp.
Referenced by ncursesMode(), and update().
|
private |
Definition at line 681 of file ProgressNCurses.cpp.
Referenced by Dashboard(), ncursesMode(), and ~Dashboard().
|
private |
Definition at line 680 of file ProgressNCurses.cpp.
Referenced by Dashboard(), uiThread(), and ~Dashboard().
|
private |
Definition at line 680 of file ProgressNCurses.cpp.
Referenced by Dashboard(), ncursesMode(), and ~Dashboard().
|
private |
Definition at line 683 of file ProgressNCurses.cpp.
Referenced by Dashboard(), uiThread(), and ~Dashboard().
|
private |
Definition at line 683 of file ProgressNCurses.cpp.
Referenced by Dashboard(), ncursesMode(), and ~Dashboard().
|
private |
Definition at line 688 of file ProgressNCurses.cpp.
Referenced by handleSignal(), ncursesMode(), and update().
|
private |
Definition at line 675 of file ProgressNCurses.cpp.
Referenced by Dashboard(), and ~Dashboard().