#pragma once #include #include #include #include "lib/message_queue.h" #include "lib/mutex.h" #include "object/kernel_object.h" class Endpoint; class ReplyPort; template <> struct KernelObjectTag { static const uint64_t type = KernelObject::ENDPOINT; }; class Endpoint : public KernelObject { public: uint64_t TypeTag() override { return KernelObject::ENDPOINT; } static glcr::RefPtr Create(); glcr::ErrorCode Write(uint64_t num_bytes, const void* data, z_cap_t reply_port_cap); glcr::ErrorCode Read(uint64_t* num_bytes, void* data, z_cap_t* reply_port_cap); private: Mutex mutex_{"endpoint"}; UnboundedMessageQueue message_queue_; glcr::IntrusiveList blocked_threads_; Endpoint() {} };