[zion/glacier] Move RefPtr to glacier.

This commit is contained in:
Drew Galbraith 2023-06-21 15:07:40 -07:00
parent 8bcb574677
commit e1af79b975
26 changed files with 130 additions and 106 deletions

View file

@ -1,12 +1,13 @@
#pragma once
#include <glacier/memory/ref_ptr.h>
#include "capability/capability.h"
#include "include/ztypes.h"
#include "lib/linked_list.h"
#include "lib/message_queue.h"
#include "lib/mutex.h"
#include "lib/pair.h"
#include "lib/ref_ptr.h"
#include "object/kernel_object.h"
#include "usr/zcall_internal.h"
@ -20,9 +21,9 @@ struct KernelObjectTag<Channel> {
class Channel : public KernelObject {
public:
uint64_t TypeTag() override { return KernelObject::CHANNEL; }
static Pair<RefPtr<Channel>, RefPtr<Channel>> CreateChannelPair();
static Pair<glcr::RefPtr<Channel>, glcr::RefPtr<Channel>> CreateChannelPair();
RefPtr<Channel> peer() { return peer_; }
glcr::RefPtr<Channel> peer() { return peer_; }
z_err_t Write(uint64_t num_bytes, const void* bytes, uint64_t num_caps,
const z_cap_t* caps);
@ -32,16 +33,16 @@ class Channel : public KernelObject {
private:
// FIXME: We will likely never close the channel based on this
// circular dependency.
RefPtr<Channel> peer_{nullptr};
glcr::RefPtr<Channel> peer_{nullptr};
Mutex mutex_{"channel"};
UnboundedMessageQueue message_queue_;
LinkedList<RefPtr<Thread>> blocked_threads_;
LinkedList<glcr::RefPtr<Thread>> blocked_threads_;
friend class MakeRefCountedFriend<Channel>;
friend class glcr::MakeRefCountedFriend<Channel>;
Channel() {}
void SetPeer(const RefPtr<Channel>& peer) { peer_ = peer; }
void SetPeer(const glcr::RefPtr<Channel>& peer) { peer_ = peer; }
z_err_t WriteInternal(uint64_t num_bytes, const void* bytes,
uint64_t num_caps, const z_cap_t* caps);