Removed unnecessary class mx::system::thread.

This commit is contained in:
Michael Müller
2022-07-07 10:52:15 +02:00
parent 76eb44b2d3
commit 8c4a7678f4

View File

@@ -1,39 +0,0 @@
#pragma once
#include <chrono>
#include <cstdint>
#include <iostream>
#include <thread>
namespace mx::system {
/**
* Encapsulates methods for thread access.
*/
/* Deprecated for Genode */
/* Done: mx::system::thread : Replace POSIX-style thread pinning with Genode thread affinities */
class thread
{
public:
/**
* Pins a thread to a given core.
*
* @param thread Thread to pin.
* @param core_id Core where the thread should be pinned.
* @return True, when pinning was successful.
*/
static bool pin(std::thread &thread, const std::uint16_t core_id)
{
cpu_set_t cpu_set;
CPU_ZERO(&cpu_set);
CPU_SET(core_id, &cpu_set);
if (pthread_setaffinity_np(thread.native_handle(), sizeof(cpu_set_t), &cpu_set) != 0)
{
std::cerr << "Can not pin thread!" << std::endl;
return false;
}
return true;
}
};
} // namespace mx::system