projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1ca8026
)
Speed improvement: Moving check online to different thread
author
Tobias Markus
<tobbi@mozilla-uk.org>
Sun, 15 Dec 2013 20:24:37 +0000
(21:24 +0100)
committer
Tobias Markus
<tobbi@mozilla-uk.org>
Sun, 15 Dec 2013 20:24:37 +0000
(21:24 +0100)
src/supertux/menu/addon_menu.cpp
patch
|
blob
|
history
diff --git
a/src/supertux/menu/addon_menu.cpp
b/src/supertux/menu/addon_menu.cpp
index
a3cc6d5
..
e6ba6c5
100644
(file)
--- a/
src/supertux/menu/addon_menu.cpp
+++ b/
src/supertux/menu/addon_menu.cpp
@@
-18,6
+18,7
@@
#include <config.h>
#include <algorithm>
+#include <thread>
#include <boost/format.hpp>
#include "addon/addon.hpp"
@@
-31,6
+32,12
@@
bool generate_addons_menu_sorter(const Addon* a1, const Addon* a2)
return a1->title < a2->title;
}
+void check_online() // Shortcut to expensive function to be called by a thread
+{
+ AddonManager::get_instance().check_online();
+}
+
+
} // namespace
AddonMenu::AddonMenu() :
@@
-132,7
+139,8
@@
AddonMenu::check_menu()
{
try
{
- AddonManager::get_instance().check_online();
+ std::thread addonThread(check_online);
+ addonThread.join();
refresh();
set_active_item(index);
}