mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2025-02-17 08:51:13 +00:00
Use boost threads to run the update installation on a background thread.
This commit is contained in:
parent
8e47110231
commit
2efb4fcaf3
2 changed files with 8 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
add_definitions(-DTIXML_USE_STL)
|
add_definitions(-DTIXML_USE_STL)
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ target_link_libraries(updater
|
||||||
tinyxml
|
tinyxml
|
||||||
minizip
|
minizip
|
||||||
# TODO - Mac and Windows version
|
# TODO - Mac and Windows version
|
||||||
|
pthread
|
||||||
/usr/lib/libboost_thread.a
|
/usr/lib/libboost_thread.a
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
void setupUi(UpdateInstaller* installer);
|
void setupUi(UpdateInstaller* installer);
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
@ -43,7 +46,10 @@ int main(int argc, char** argv)
|
||||||
installer.setPackageDir(options.packageDir);
|
installer.setPackageDir(options.packageDir);
|
||||||
installer.setScript(&script);
|
installer.setScript(&script);
|
||||||
installer.setWaitPid(options.waitPid);
|
installer.setWaitPid(options.waitPid);
|
||||||
|
|
||||||
installer.run();
|
installer.run();
|
||||||
|
boost::thread updaterThread(boost::bind(&UpdateInstaller::run,&installer));
|
||||||
|
updaterThread.join();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue