Remove the automation thread priority stuff

It hasn't actually been used for anything for a while, and if a single
normal-priority thread can make your system unresponsive it's time to
upgrade to an OS that's isn't garbage.
This commit is contained in:
Thomas Goyne 2014-07-21 09:56:24 -07:00
parent 0cc941e559
commit de686bdb6f
7 changed files with 4 additions and 17 deletions

View file

@ -68,13 +68,12 @@ namespace agi {
/// @brief Run a function on a background thread
/// @param task Function to run
/// @param priority Thread priority or -1 for default
/// @throws agi::UserCancelException on cancel
///
/// Blocks the calling thread until the task completes or is canceled.
/// Progress updates sent to the progress sink passed to the task should
/// be displayed to the user in some way, along with some way for the
/// user to cancel the task.
virtual void Run(std::function<void(ProgressSink *)> task, int priority=-1)=0;
virtual void Run(std::function<void(ProgressSink *)> task)=0;
};
}

View file

@ -239,16 +239,10 @@ namespace Automation4 {
void BackgroundScriptRunner::Run(std::function<void (ProgressSink*)> task)
{
int prio = OPT_GET("Automation/Thread Priority")->GetInt();
if (prio == 0) prio = 50; // normal
else if (prio == 1) prio = 30; // below normal
else if (prio == 2) prio = 10; // lowest
else prio = 50; // fallback normal
impl->Run([&](agi::ProgressSink *ps) {
ProgressSink aps(ps, this);
task(&aps);
}, prio);
});
}
wxWindow *BackgroundScriptRunner::GetParentWindow() const

View file

@ -143,7 +143,7 @@ DialogProgress::DialogProgress(wxWindow *parent, wxString const& title_text, wxS
Bind(wxEVT_TIMER, [=](wxTimerEvent&) { gauge->Pulse(); });
}
void DialogProgress::Run(std::function<void(agi::ProgressSink*)> task, int priority) {
void DialogProgress::Run(std::function<void(agi::ProgressSink*)> task) {
DialogProgressSink ps(this);
this->ps = &ps;

View file

@ -64,5 +64,5 @@ public:
DialogProgress(wxWindow *parent, wxString const& title="", wxString const& message="");
/// BackgroundWorker implementation
void Run(std::function<void(agi::ProgressSink *)> task, int priority=-1) override;
void Run(std::function<void(agi::ProgressSink *)> task) override;
};

View file

@ -94,7 +94,6 @@
"Automation" : {
"Autoreload Mode" : 1,
"Thread Priority" : 1,
"Trace Level" : 3
},

View file

@ -94,7 +94,6 @@
"Automation" : {
"Autoreload Mode" : 1,
"Thread Priority" : 1,
"Trace Level" : 3
},

View file

@ -324,10 +324,6 @@ void Automation(wxTreebook *book, Preferences *parent) {
wxArrayString tl_choice(6, tl_arr);
p->OptionChoice(general, _("Trace level"), tl_choice, "Automation/Trace Level");
const wxString tp_arr[3] = { _("Normal"), _("Below Normal (recommended)"), _("Lowest") };
wxArrayString tp_choice(3, tp_arr);
p->OptionChoice(general, _("Thread priority"), tp_choice, "Automation/Thread Priority");
const wxString ar_arr[4] = { _("No scripts"), _("Subtitle-local scripts"), _("Global autoload scripts"), _("All scripts") };
wxArrayString ar_choice(4, ar_arr);
p->OptionChoice(general, _("Autoreload on Export"), ar_choice, "Automation/Autoreload Mode");