mirror of https://github.com/odrling/Aegisub
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:
parent
0cc941e559
commit
de686bdb6f
|
@ -68,13 +68,12 @@ namespace agi {
|
||||||
|
|
||||||
/// @brief Run a function on a background thread
|
/// @brief Run a function on a background thread
|
||||||
/// @param task Function to run
|
/// @param task Function to run
|
||||||
/// @param priority Thread priority or -1 for default
|
|
||||||
/// @throws agi::UserCancelException on cancel
|
/// @throws agi::UserCancelException on cancel
|
||||||
///
|
///
|
||||||
/// Blocks the calling thread until the task completes or is canceled.
|
/// Blocks the calling thread until the task completes or is canceled.
|
||||||
/// Progress updates sent to the progress sink passed to the task should
|
/// 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
|
/// be displayed to the user in some way, along with some way for the
|
||||||
/// user to cancel the task.
|
/// 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;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,16 +239,10 @@ namespace Automation4 {
|
||||||
|
|
||||||
void BackgroundScriptRunner::Run(std::function<void (ProgressSink*)> task)
|
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) {
|
impl->Run([&](agi::ProgressSink *ps) {
|
||||||
ProgressSink aps(ps, this);
|
ProgressSink aps(ps, this);
|
||||||
task(&aps);
|
task(&aps);
|
||||||
}, prio);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow *BackgroundScriptRunner::GetParentWindow() const
|
wxWindow *BackgroundScriptRunner::GetParentWindow() const
|
||||||
|
|
|
@ -143,7 +143,7 @@ DialogProgress::DialogProgress(wxWindow *parent, wxString const& title_text, wxS
|
||||||
Bind(wxEVT_TIMER, [=](wxTimerEvent&) { gauge->Pulse(); });
|
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);
|
DialogProgressSink ps(this);
|
||||||
this->ps = &ps;
|
this->ps = &ps;
|
||||||
|
|
||||||
|
|
|
@ -64,5 +64,5 @@ public:
|
||||||
DialogProgress(wxWindow *parent, wxString const& title="", wxString const& message="");
|
DialogProgress(wxWindow *parent, wxString const& title="", wxString const& message="");
|
||||||
|
|
||||||
/// BackgroundWorker implementation
|
/// BackgroundWorker implementation
|
||||||
void Run(std::function<void(agi::ProgressSink *)> task, int priority=-1) override;
|
void Run(std::function<void(agi::ProgressSink *)> task) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -94,7 +94,6 @@
|
||||||
|
|
||||||
"Automation" : {
|
"Automation" : {
|
||||||
"Autoreload Mode" : 1,
|
"Autoreload Mode" : 1,
|
||||||
"Thread Priority" : 1,
|
|
||||||
"Trace Level" : 3
|
"Trace Level" : 3
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,6 @@
|
||||||
|
|
||||||
"Automation" : {
|
"Automation" : {
|
||||||
"Autoreload Mode" : 1,
|
"Autoreload Mode" : 1,
|
||||||
"Thread Priority" : 1,
|
|
||||||
"Trace Level" : 3
|
"Trace Level" : 3
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -324,10 +324,6 @@ void Automation(wxTreebook *book, Preferences *parent) {
|
||||||
wxArrayString tl_choice(6, tl_arr);
|
wxArrayString tl_choice(6, tl_arr);
|
||||||
p->OptionChoice(general, _("Trace level"), tl_choice, "Automation/Trace Level");
|
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") };
|
const wxString ar_arr[4] = { _("No scripts"), _("Subtitle-local scripts"), _("Global autoload scripts"), _("All scripts") };
|
||||||
wxArrayString ar_choice(4, ar_arr);
|
wxArrayString ar_choice(4, ar_arr);
|
||||||
p->OptionChoice(general, _("Autoreload on Export"), ar_choice, "Automation/Autoreload Mode");
|
p->OptionChoice(general, _("Autoreload on Export"), ar_choice, "Automation/Autoreload Mode");
|
||||||
|
|
Loading…
Reference in New Issue