Arguments to Task are now forwarded to std::thread more correctly

Change-Id: I81a934a6fac4ead30c67010e9968e46ad2f86571
This commit is contained in:
Tyler Veness
2015-07-22 00:13:28 -07:00
parent 6d854afb0e
commit d59016be35
3 changed files with 12 additions and 3 deletions

View File

@@ -42,6 +42,16 @@ ClassName(ClassName &&) = default
#define DEPRECATED(msg) /*nothing*/
#endif
// Provide std::decay_t when using GCC < 4.9
#if defined(__GNUC__)
#if __GNUC__ == 4 && __GNUC_MINOR__ < 9
#include <type_traits>
namespace std {
template <class T> using decay_t = typename decay<T>::type;
}
#endif
#endif
// A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer
// that is being deleted by someone else.
// This should only be called in deprecated functions; using it anywhere else

View File

@@ -12,8 +12,6 @@
#include <string>
#include <thread>
#include <string>
/**
* Wrapper class around std::thread that allows changing thread priority
*/

View File

@@ -15,7 +15,8 @@ Task::Task(const std::string& name, Function&& function, Args&&... args) {
std::cout << "[HAL] Starting task " << m_taskName << "..." << std::endl;
m_thread = std::thread(function, args...);
m_thread = std::thread(std::forward<std::decay_t<Function>>(function),
std::forward<Args>(args)...);
//TODO: lvuser does not currently have permissions to set the priority.
//SetPriority(kDefaultPriority);