[glacier] Move Pair to glacier.

This commit is contained in:
Drew Galbraith 2023-06-21 20:47:40 -07:00
parent c2dfe17363
commit 0ec2fa3e76
3 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
namespace glcr {
template <typename T, typename U> template <typename T, typename U>
class Pair { class Pair {
public: public:
@ -11,3 +13,5 @@ class Pair {
T first_; T first_;
U second_; U second_;
}; };
} // namespace glcr

View File

@ -3,7 +3,7 @@
#include "include/ztypes.h" #include "include/ztypes.h"
#include "scheduler/scheduler.h" #include "scheduler/scheduler.h"
Pair<glcr::RefPtr<Channel>, glcr::RefPtr<Channel>> glcr::Pair<glcr::RefPtr<Channel>, glcr::RefPtr<Channel>>
Channel::CreateChannelPair() { Channel::CreateChannelPair() {
auto c1 = glcr::MakeRefCounted<Channel>(); auto c1 = glcr::MakeRefCounted<Channel>();
auto c2 = glcr::MakeRefCounted<Channel>(); auto c2 = glcr::MakeRefCounted<Channel>();

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#include <glacier/container/intrusive_list.h> #include <glacier/container/intrusive_list.h>
#include <glacier/container/pair.h>
#include <glacier/memory/ref_ptr.h> #include <glacier/memory/ref_ptr.h>
#include "capability/capability.h" #include "capability/capability.h"
#include "include/ztypes.h" #include "include/ztypes.h"
#include "lib/message_queue.h" #include "lib/message_queue.h"
#include "lib/mutex.h" #include "lib/mutex.h"
#include "lib/pair.h"
#include "object/kernel_object.h" #include "object/kernel_object.h"
#include "usr/zcall_internal.h" #include "usr/zcall_internal.h"
@ -21,7 +21,8 @@ struct KernelObjectTag<Channel> {
class Channel : public KernelObject { class Channel : public KernelObject {
public: public:
uint64_t TypeTag() override { return KernelObject::CHANNEL; } uint64_t TypeTag() override { return KernelObject::CHANNEL; }
static Pair<glcr::RefPtr<Channel>, glcr::RefPtr<Channel>> CreateChannelPair(); static glcr::Pair<glcr::RefPtr<Channel>, glcr::RefPtr<Channel>>
CreateChannelPair();
glcr::RefPtr<Channel> peer() { return peer_; } glcr::RefPtr<Channel> peer() { return peer_; }