forked from Bananymous/banan-os
Kernel: Make thread unblocking O(1)
This is still bit broken. VirtualBox seems to freeze sometimes, but I could not recreate this on qemu (with and without kvm) or real hardware.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <BAN/Formatter.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
class ProcessorID
|
||||
{
|
||||
public:
|
||||
using value_type = uint32_t;
|
||||
|
||||
public:
|
||||
ProcessorID() = default;
|
||||
|
||||
uint32_t as_u32() const { return m_id; }
|
||||
bool operator==(ProcessorID other) const { return m_id == other.m_id; }
|
||||
|
||||
private:
|
||||
explicit ProcessorID(uint32_t id) : m_id(id) {}
|
||||
|
||||
private:
|
||||
uint32_t m_id = static_cast<uint32_t>(-1);
|
||||
|
||||
friend class Processor;
|
||||
friend class APIC;
|
||||
};
|
||||
|
||||
inline constexpr ProcessorID PROCESSOR_NONE { };
|
||||
|
||||
}
|
||||
|
||||
namespace BAN::Formatter
|
||||
{
|
||||
|
||||
template<typename F>
|
||||
void print_argument(F putc, Kernel::ProcessorID processor_id, const ValueFormat& format)
|
||||
{
|
||||
print_argument(putc, processor_id.as_u32(), format);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user