Use boost threads to run the update installation on a background thread.

This commit is contained in:
Robert Knight 2011-08-20 12:52:47 +01:00
parent 8e47110231
commit 2efb4fcaf3
2 changed files with 8 additions and 0 deletions

View file

@ -1,5 +1,6 @@
find_package(Boost REQUIRED)
find_package(Threads REQUIRED)
add_definitions(-DTIXML_USE_STL)
@ -34,6 +35,7 @@ target_link_libraries(updater
tinyxml
minizip
# TODO - Mac and Windows version
pthread
/usr/lib/libboost_thread.a
)

View file

@ -12,6 +12,9 @@
#include <iostream>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
void setupUi(UpdateInstaller* installer);
int main(int argc, char** argv)
@ -43,7 +46,10 @@ int main(int argc, char** argv)
installer.setPackageDir(options.packageDir);
installer.setScript(&script);
installer.setWaitPid(options.waitPid);
installer.run();
boost::thread updaterThread(boost::bind(&UpdateInstaller::run,&installer));
updaterThread.join();
return 0;
}