Use 64-bit: use std::thread to avoid void* cast

This commit is contained in:
Jacob Bandes-Storch
2012-08-27 10:07:11 -07:00
committed by Allan Odgaard
parent dca4292990
commit c976bce24d
2 changed files with 3 additions and 8 deletions

View File

@@ -201,10 +201,9 @@ namespace oak
return "???";
}
static void* relaunch_thread (void* userdata)
static void relaunch_thread (pid_t pid)
{
oak::set_thread_name("application_t::relaunch");
pid_t pid = (pid_t)userdata;
int status = 0;
if(waitpid(pid, &status, 0) != pid)
@@ -215,8 +214,6 @@ namespace oak
fprintf(stderr, "*** relaunch failed: process terminated abnormally %d.\n", status);
else
fprintf(stderr, "*** relaunch failed: process terminated with status %d.\n", status);
return NULL;
}
void application_t::relaunch (bool disableUserInteraction)
@@ -240,10 +237,7 @@ namespace oak
}
else
{
pthread_t thread;
if(pthread_create(&thread, NULL, &relaunch_thread, (void*)pid) == 0)
pthread_detach(thread);
else perror("pthread_create()");
std::thread(relaunch_thread, pid).detach();
}
}

View File

@@ -27,6 +27,7 @@
#include <vector>
#include <memory>
#include <numeric>
#include <thread>
#include <boost/optional.hpp>
#include <boost/variant.hpp>
#include <boost/bimap/bimap.hpp>