classes及messages

classes及messages

全局配置

class GlobalData

成员变量
CyberConfig config_CHECK(InitConfig())
std::string host_ip_InitHostInfo()
:string host_name_InitHostInfo()
int process_id_getpid()
std::string process_group_“cyber_default_” + std::to_string(process_id_)
std::string sched_name_“CYBER_DEFAULT”
bool is_reality_mode_true
static AtomicHashMap<uint64_t, std::string, 512> node_id_map_
static AtomicHashMap<uint64_t, std::string, 256> channel_id_map_
static AtomicHashMap<uint64_t, std::string, 256> service_id_map_
static AtomicHashMap<uint64_t, std::string, 256> task_id_map_

message CyberConfig

成员变量
optional SchedulerConf scheduler_conf = 1;
optional TransportConf transport_conf = 2;
optional RunModeConf run_mode_conf = 3;

class AtomicHashMap

成员变量
Bucket table_[TableSize]TableSize=128默认
uint64_t capacity_TableSize
uint64_t mode_num_capacity_-1

enum State:std::unit8_t

成员变量
STATE_UNINITIALIZED
STATE_INITIALIZED
STATE_SHUTTING_DOWN
STATE_SHUTDOWN

class Transport /单例

成员变量
std::atomic is_shutdown_
ParticipantPtr participant_
NotifierPtr notifier_
IntraDispatcherPtr intra_dispatcher_
ShmDispatcherPtr shm_dispatcher_
RtpsDispatcherPtr rtps_dispatcher_
成员函数属性
CreateTransmitter(const RoleAttributes& attr,const OptionalMode& mode = OptionalMode::HYBRID)public
CreateReceiver(const RoleAttributes& attr,const OptionalMode& mode = OptionalMode::HYBRID)public

class TopologyManager /单例

成员变量
std::atomic init_
NodeManagerPtr node_manager_
ChannelManagerPtr channel_manager_
ServiceManagerPtr service_manager_
transport::ParticipantPtr participant_
ParticipantListener* participant_listener_
ChangeSignal change_signal_
PartNameContainer participant_names_

通信

class Node

成员变量
std::string node_name_节点名字
std::string name_space_一般为空
std::mutex readers_mutex_
std::map<std::string, std::shared_ptr> readers_readers_.emplace(std::make_pair(channel_name, reader));
std::unique_ptr node_channel_impl_new NodeChannelImpl(node_name)
std::unique_ptr node_service_impl_#new NodeServiceImpl(node_name)

messages RoleAttributes

成员变量
optional string host_name = 1;
optional string host_ip = 2;
optional int32 process_id = 3;
optional string node_name = 4;
optional uint64 node_id = 5; // hash value of node_name
// especially for WRITER and READER
optional string channel_name = 6;
optional uint64 channel_id = 7; // hash value of channel_name
optional string message_type = 8;
optional bytes proto_desc = 9;
optional uint64 id = 10;
optional QosProfile qos_profile = 11;
optional SocketAddr socket_addr = 12; // reserved for socket communication
// especially for SERVER and CLIENT
optional string service_name = 13;
optional uint64 service_id = 14;

class NodeChannelImpl

class NodeChannelImpl 成员变量
bool is_reality_mode_假定true
string node_name_节点名字
proto::RoleAttributes node_attr_见下表
NodeManagerPtr node_manager_service_discovery::TopologyManager::Instance()->node_manager();
成员变量proto::RoleAttributes node_attr_
optional string host_name = 1;common::GlobalData::Instance()->HostName()
optional string host_ip = 2;common::GlobalData::Instance()->HostIp()
optional int32 process_id = 3;common::GlobalData::Instance()->ProcessId()
string node_name = 4;node_name
optional uint64 node_id = 5; // hash value of node_namecommon::GlobalData::RegisterNode(node_name)
// especially for WRITER and READER
optional string channel_name = 6;
optional uint64 channel_id = 7; // hash value of channel_name
optional string message_type = 8;
optional bytes proto_desc = 9;
optional uint64 id = 10;
optional QosProfile qos_profile = 11;
optional SocketAddr socket_addr = 12; // reserved for socket communication
// especially for SERVER and CLIENT
optional string service_name = 13;
optional uint64 service_id = 14;
部分成员函数局部变量
CreateWriter(const proto::RoleAttributes& role_attr)new_attr FillInAttr(&new_attr);//为new_attr赋初值
CreateReader(const proto::RoleAttributes& role_attr, const CallbackFunc& reader_func, uint32_t pending_queue_size)new_attr FillInAttr(&new_attr);//为new_attr赋初值
CreateWriter/CreateReader 局部变量 new_attr_
optional string host_name = 1;node_attr_.host_name()
optional string host_ip = 2;node_attr_.host_ip()
optional int32 process_id = 3;node_attr_.process_id()
string node_name = 4;node_name
optional uint64 node_id = 5; // hash value of node_namecommon::GlobalData::RegisterNode(node_name)
// especially for WRITER and READER
optional string channel_name = 6;channel_name
optional uint64 channel_id = 7; // hash value of channel_nameGlobalData::RegisterChannel(channel_name);
optional string message_type = 8;message::MessageType()
optional bytes proto_desc = 9;message::GetDescriptorString(attr->message_type(), &proto_desc);
optional uint64 id = 10;
optional QosProfile qos_profile = 11;attr->mutable_qos_profile()->CopyFrom(transport::QosProfileConf::QOS_PROFILE_DEFAULT);
optional SocketAddr socket_addr = 12; // reserved for socket communication
// especially for SERVER and CLIENT
optional string service_name = 13;
optional uint64 service_id = 14;

class Manager

using ChangeSignal = base::Signal<const ChangeMsg&>;

成员变量/protected
std::atomic is_shutdown_false
std::atomic is_discovery_started_false
int allowed_role_0
ChangeType change_type_proto::ChangeType::CHANGE_PARTICIPANT
std::string host_name_host_name_ = common::GlobalData::Instance()->HostName()
int process_id_common::GlobalData::Instance()->ProcessId()
std::string channel_name_“”
eprosima::fastrtps::Publisher* publisher_nullptr
eprosima::fastrtps::Subscriber* subscriber_;nullptr
SubscriberListener* listener_;nullptr
ChangeSignal signal_signal_(msg),修改于Manager::Notify(const ChangeMsg& msg)
部分成员函数局部变量
Join(const RoleAttributes& attr, RoleType role, bool need_publish) 其中attr=node_attr_,need_publish=trueChangeMsg msg ;Convert(attr, role, OperateType::OPT_JOIN, &msg);
ChangeConnection AddChangeListener(const ChangeFunc& func)

message ChangeMsg

成员变量
optional uint64 timestamp = 1;cyber::Time::Now().ToNanosecond()
optional ChangeType change_type = 2;change_type_
optional OperateType operate_type = 3;OperateType::OPT_JOIN
optional RoleType role_type = 4;proto::RoleType::ROLE_WRITER或NODE或…
optional RoleAttributes role_attr = 5;NodeChannelImpl类中node_attr_或Writer中的role_attr__

class NodeManager

using NodeWarehouse = SingleValueWarehouse

class NodeManager : public Manager
NodeWarehouse nodes_SingleValueWarehouse nodes_
allowed_role_allowed_role_ | (1 << RoleType::ROLE_NODE)
change_type_ChangeType::CHANGE_NODE;
channel_name_“node_change_broadcast”

class ChannelManager

using WriterWarehouse = MultiValueWarehouse;

using ReaderWarehouse = MultiValueWarehouse;

class ChannelManager : public Manager
ExemptedMessageTypes exempted_msg_types_emplace(message::MessageType< message::RawMessage>()); emplace(message::MessageType< message::PyMessageWrap>());
Graph node_graph_node_graph_.Insert(e),其中e为ChannelManager::DisposeJoin函数中Edge e;
WriterWarehouse node_writers_node_writers_.Add(role->attributes().node_id(), role),在ChannelManager::DisposeJoin中
ReaderWarehouse node_readers_node_readers_.node_readers_.Add(role->attributes().node_id(), role)
WriterWarehouse channel_writers_channel_writers_.Add(role->attributes().channel_id(), role)
ReaderWarehouse channel_readers_channel_readers_.Add(role->attributes().channel_id(), role)
allowed_role_allowed_role_|(1 << RoleType::ROLE_WRITER)|1 << (RoleType::ROLE_READER)
change_type_ChangeType::CHANGE_CHANNEL
channel_name_channel_name_ = “channel_change_broadcast”;

class MultiValueWarehouse

class MultiValueWarehouse : public WarehouseBase
RoleMap roles_std::unordered_multimap<uint64_t, RolePtr> roles_
base::AtomicRWLock rw_lock_

class WriterBase

成员变量/protected
proto::RoleAttributes role_attr_role_attr__.id=transmitter_->id().HashValue(), 其他部分与new_attr相同
mutable std::mutex lock_
bool init_true

class Writer

class Writer : public WriterBase
TransmitterPtr transmitter_transport::Transport::Instance()->CreateTransmitter(role_attr_) =std::make_shared<ShmTransmitter>(modified_attr)
ChangeConnection change_conn_channel_manager_->AddChangeListener(std::bind( &Writer::OnChannelChange, this, std::placeholders::_1)); =Connection
service_discovery::ChannelManagerPtr channel_manager_service_discovery::TopologyManager::Instance()-> channel_manager();

class Endpoint

成员变量/protected
bool enabled_true
Identity id_id()
RoleAttributes attr_Writer或Reader类中的role_attr_

class Transmitter

class Transmitter : public Endpoint /protected
uint64_t seq_num_0
MessageInfo msg_info_msg_info_.set_sender_id(this->id_); msg_info_.set_seq_num(this->seq_num_);

class MessageInfo

成员变量
Identity sender_id_msg_info_.set_sender_id(this->id_); 其中this->id_在Transmitter中
uint64_t seq_num_msg_info_.set_seq_num(this->seq_num_); 其中this->seq_num_在Transmitter中
Identity spare_id_msg_info_.set_seq_num(NextSeqNum()); 在Transmitter::Transmit函数中实现

class ReadableInfo

函数bool ShmTransmitter::Transmit(const M& msg, const MessageInfo& msg_info)中

ReadableInfo readable_info(host_id__, wb.index, channel_id_);

成员变量
uint64_t host_id_host_id_,在bool ShmTransmitter::Transmit函数
uint32_t block_index_wb.index
uint64_t channel_id_channel_id_

class ShmTransmitter

class ShmTransmitter : public Transmitter
SegmentPtr segment_std::make_shared(channel_id_, WRITE_ONLY)
uint64_t channel_id_attr.channel_id(), 其中attr=Writer中的role_attr_
uint64_t host_id_common::Hash(attr.host_ip())
NotifierPtr notifier_NotifierFactory::CreateNotifier()=ConditionNtifier::Instance()
成员函数局部变量
ShmTransmitter::Transmit(const M& msg, const MessageInfo& msg_info)WritableBlock wb

class Segment

ShmTransmitter::Enable()函数中

segment_ = std::make_shared(channel_id_, WRITE_ONLY);

bool Segment::OpenOrCreate()

成员函数
bool init_false
key_t id_static_cast<key_t>(channel_id)
ReadWriteMode mode_WRITE_ONLY
ShmConf conf_conf_()
state_nullptr
Block* blocks_nullptr
void* managed_shm_nullptr
std::mutex block_buf_lock_block_buf_lock_()
std::unordered_map<uint32_t, uint8_t*> block_buf_addrs_block_buf_addrs_()

struct WritableBlock

Segment::AcquireBlockToWrite(std::size_t msg_size, WritableBlock* writable_block)

成员函数初始值
uint32_t indexwritable_block->index = index
Block* blockwritable_block->block = &blocks_[index]
uint8_t* bufwritable_block->buf = block_buf_addrs_[index] ,保存msg及msg_info_

class Block

ShmTransmitter::Transmit(const M& msg, const MessageInfo& msg_info)

成员变量
volatile std::atomic<int32_t> lock_num_ = {0};
uint64_t msg_size_;wb.block->set_msg_size(msg_size)
uint64_t msg_info_size_;wb.block->set_msg_info_size(MessageInfo::kSize)

class Vertice

成员变量
std::string value_msg.role_attr().node_name() ,其中msg为Manager::Join函数中的ChangeMsg msg;

class Edge

成员变量
Vertice src_v(msg.role_attr().node_name()),其中msg为Manager::Join函数中的ChangeMsg msg;
Vertice dst_v(msg.role_attr().node_name())
std::string value_msg.role_attr().channel_name()

class PerfEventCache

单例

成员变量
std::thread io_thread_
std::ofstream of_
bool enable_trans_perf_ = false
bool enable_sched_perf_ = false
std::atomic shutdown_ = {false}
base::BoundedQueue event_queue_EventBasePtr e = std::make_shared() event_queue_.Enqueue(e)
const int kFlushSize = 512
const uint64_t kEventQueueSize = 8192

class EventBase

成员变量/protected
int etype_
int eid_
uint64_t stamp_

class TransportEvent

PerfEventCache::Instance()->AddTransportEvent(
TransPerf::TRANS_FROM, attr_.channel_id(), msg_info_.seq_num())

class TransportEvent : public EventBase
uint64_t msg_seq_ = 0;msg_seq=msg_info_.seq_num()
uint64_t channel_id_ = UINT64_MAX;channel_id=attr_.channel_id()
int etype_EventType::TRANS_EVENT
int eid_static_cast(event_id),其中event_id=TransPerf::TRANS_FROM
uint64_t stamp_Time::Now().ToNanosecond()

class NotifierFactory

成员函数属性
static NotifierPtr CreateNotifier()public
static NotifierPtr CreateConditionNotifier()private
static NotifierPtr CreateMulticastNotifier()private

class NotifierBase

成员函数属性
virtual ~NotifierBase() = defaultpublic
virtual void Shutdown() = 0public
virtual bool Notify(const ReadableInfo& info) = 0public
virtual bool Listen(int timeout_ms, ReadableInfo* info) = 0public

class MulticastNotifier

class MulticastNotifier : public NotifierBase
int notify_fd_ = -1
struct sockaddr_in notify_addr_
int listen_fd_ = -1
struct sockaddr_in listen_addr_
std::atomic is_shutdown_ = {false}

class ConditionNotifier

const uint32_t kBufLength = 4096;

class ConditionNotifier : public NotifierBase
key_t key_ = 0
void* managed_shm_ = nullptr
size_t shm_size_ = 0
Indicator* indicator_ = nullptr见下表
uint64_t next_listen_num_ = 0
std::atomic is_shutdown_ = {false}

bool ConditionNotifier::Notify(const ReadableInfo& info)

ndicator* indicator_
std::mutex mtx;
std::condition_variable cv;indicator_->cv.notify_all()
uint64_t written_info_num = 0;++indicator_->written_info_num
ReadableInfo infos[kBufLength];indicator_->infos[idx] = info

class ReaderBase

成员变量/protected
proto::RoleAttributes role_attr_role_attr__.id=receiver_->id().HashValue(), 其他部分与new_attr相同
std::atomic init_true

class Reader

class Reader : public ReaderBase
double latest_recv_time_sec_ = -1.0
double second_to_lastest_recv_time_sec_ = -1.0
uint32_t pending_queue_size_const uint32_t DEFAULT_PENDING_QUEUE_SIZE = 1
CallbackFunc reader_func_reader_fun,用户回调函数
ReceiverPtr receiver_ = nullptrReceiverManager::Instance()->GetReceiver(role_attr_)
std::string croutine_name_role_attr_.node_name() + "" + role_attr.channel_name()
BlockerPtr blocker_ = nullptr见下表
ChangeConnection change_conn_channel_manager_->AddChangeListener(std::bind( &Writer::OnChannelChange, this, std::placeholders::_1)); =Connection
service_discovery::ChannelManagerPtr channel_manager_ = nullptrservice_discovery::TopologyManager::Instance()->channel_manager()
成员函数局部变量
Reader::Reader(const proto::RoleAttributes& role_attr,
const CallbackFunc& reader_func,
uint32_t pending_queue_size)
blocker_.reset(new blocker::Blocker(blocker::BlockerAttr(role_attr.qos_profile().depth(), role_attr.channel_name())));
bool Reader::Init()std::function<void(const std::shared_ptr&)> func; auto dv = std::make_shared< data::DataVisitor>(

struct BlockerAttr

成员变量
size_t capacityrole_attr.qos_profile().depth()
std::string channel_namerole_attr.channel_name()

class Blocker

class Blocker : public BlockerBase
BlockerAttr attr_blocker::BlockerAttr(role_attr.qos_profile().depth(), role_attr.channel_name())
MessageQueue observed_msg_queue_
MessageQueue published_msg_queue_
mutable std::mutex msg_mutex_
CallbackMap published_callbacks_
mutable std::mutex cb_mutex_
MessageType dummy_msg_dummy_msg_()

class ReceiverManager

成员变量
std::unordered_map<std::string,typename std::shared_ptr< transport::Receiver>> receiver_map_;函数GetReceiver(const proto::RoleAttributes& role_attr)中修改
std::mutex receiver_map_mutex_;

class DataNotifier

using NotifyVector = std::vector < std::shared_ptr>;

成员变量
std::mutex notifies_map_mutex_;
AtomicHashMap<uint64_t, NotifyVector> notifies_map_;

struct Notifier

成员变量
std::function<void()> callback

class DataVisitorBase

成员变量
uint64_t next_msg_index_ = 0
DataNotifier* data_notifier_DataNotifier::Instance(),data_notifier_->AddNotifier(buffer_.channel_id(), notifier_)
std::shared_ptr notifier_notifier_->callback = callback,在RegisterNotifyCallback函数中

class DataVisitor

bool Reader::Init()函数中

auto dv = std::make_shared < data::DataVisitor>(role_attr_.channel_id(), pending_queue_size_);

class DataVisitor<M0, NullType, NullType, NullType> : public DataVisitorBase
ChannelBuffer buffer_buffer_(channel_id, new BufferType(queue_size))

class ChannelBuffer

using BufferType = CacheBuffer< std::shared_ptr>;

成员变量
uint64_t channel_id_channel_id
std::shared_ptr buffer_new BufferType(queue_size)

class CacheBuffer

成员变量
uint64_t head_ = 0;
uint64_t tail_ = 0;
uint64_t capacity_ = 0;queue_size+1
std::vector buffer_;buffer_.resize(capacity_);
mutable std::mutex mutex_;

class DataDispatcher

using BufferVector =

​ std::vector< std::weak_ptr< CacheBuffer< std::shared_ptr>>>;

成员变量
DataNotifier* notifier_DataNotifier::Instance()
std::mutex buffers_map_mutex_
AtomicHashMap<uint64_t, BufferVector> buffers_map_修改于DataDispatcher::Instance()->AddBuffer(buffer_)

class RoutineFactory

using VoidFunc = std::function<void()>;

using CreateRoutineFunc = std::function<VoidFunc()>;

成员变量
std::shared_ptr < data::DataVisitorBase> data_visitor_ = nullptrdv,函数bool Reader::Init()中
CreateRoutineFunc create_routine函数CreateRoutineFactory中

class Signal

using ConnectionType = Connection<Args…>;

成员变量
SlotList slots_cb=OnChannelChange; slot = std::make_shared<Slot<Args…>>(cb); slots_.emplace_back(slot);
std::mutex mutex_

class Slot

cb=OnChannelChange;

slot = std::make_shared<Slot<Args…>>(cb);

成员变量
Callback cb_cb
bool connected_true默认

class Connection

using SlotPtr = std::shared_ptr<Slot<Args…>>;

using SignalPtr = Signal<Args…>*;

Connection在函数 ConnectionType Connect(const Callback& cb)中创建

return ConnectionType(slot, this);

成员变量
SlotPtr slot_slot
SignalPtr signal_signal

class Receiver

using MessagePtr = std::shared_ptr;

using MessageListener = std::function<void( const MessagePtr&, const MessageInfo&, const RoleAttributes&)>;

class Receiver : public Endpoint
MessageListener msg_listenermsg_listener,在ReceiverManager::GetReceiver中修改

class ShmReceiver

using ShmDispatcherPtr = ShmDispatcher*;

class ShmReceiver : public Receiver
ShmDispatcherPtr dispatcher_ShmDispatcher::Instance()

.

class Dispatcher

成员变量/protected
std::atomic is_shutdown_;false
AtomicHashMap<uint64_t, ListenerHandlerBasePtr> msg_listeners_;
base::AtomicRWLock rw_lock_;

class ShmDispatcher

using SegmentContainer = std::unordered_map<uint64_t, SegmentPtr>;

成员变量
uint64_t host_id_common::Hash(GlobalData::Instance()->HostIp())
SegmentContainer segments_
std::unordered_map<uint64_t, uint32_t> previous_indexes_
AtomicRWLock segments_lock_
std::thread thread_std::thread(&ShmDispatcher::ThreadFunc, this); scheduler::Instance()->SetInnerThreadAttr(&thread_, “shm_disp”);
NotifierPtr notifier_NotifierFactory::CreateNotifier()=ConditionNotifier::Instance()

struct Indicator

成员变量
std::mutex mtx
std::condition_variable cv
uint64_t written_info_num = 0
ReadableInfo infos[kBufLength]kBufLength = 4096

class ListenerHandlerBase

成员变量
bool is_raw_message_ = false

class ListenerHandler

using Message = std::shared_ptr;

using MessageSignal = base::Signal<const Message&, const MessageInfo&>;

using Listener = std::function<void(const Message&, const MessageInfo&)>;

using MessageConnection =base::Connection<const Message&, const MessageInfo&>;

using ConnectionMap = std::unordered_map<uint64_t, MessageConnection>;

using SignalPtr = std::shared_ptr;

using MessageSignalMap = std::unordered_map<uint64_t, SignalPtr>;

class ListenerHandler : public ListenerHandlerBase
MessageSignal signal_
ConnectionMap signal_conns_
MessageSignalMap signals_
std::unordered_map<uint64_t, ConnectionMap> signals_conns_
base::AtomicRWLock rw_lock_

调度

class Scheduler

成员变量 /protected
AtomicRWLock id_cr_lock_class
std::unordered_map<uint64_t, std::mutex> id_cr_wl_
std::mutex cr_wl_mtx_
std::unordered_map<uint64_t, std::shared_ptr> id_cr_id_cr_[cr->id()] = cr,在SchedulerClassic::DispatchTask中
std::vector< std::shared_ptr> pctxs_pctxs_.emplace_back(ctx),在SchedulerClassic::CreateProcessor()函数中
std::vector< std::shared_ptr> processors_processors_.emplace_back(proc)
uint32_t proc_num_ = 0
uint32_t task_pool_size_ = 0
std::atomic stop_
成员函数
bool CreateTask(const RoutineFactory& factory, const std::string& name)
bool CreateTask(std::function<void()>&& func, const std::string& name, std::shared_ptr visitor = nullptr);

class SchedulerChoreography

class SchedulerChoreography : public Scheduler
std::unordered_map<std::string, ChoreographyTask> cr_confs_
std::unordered_map<std::string, InnerThread> inner_thr_confs_
int32_t choreography_processor_prio_
int32_t pool_processor_prio_
std::string choreography_affinity_
std::string pool_affinity_
std::string choreography_processor_policy_
std::string pool_processor_policy_
std::vector choreography_cpuset_
std::vector pool_cpuset_

class SchedulerClassic

class SchedulerClassic : public Scheduler
std::unordered_map<std::string, ClassicTask> cr_confs_cr_confs_[task.name()] = task,在SchedulerClassic 构造函数中,一个read是一个task
ClassicConf classic_conf_classic_conf_ = cfg.scheduler_conf().classic_conf();

class CRoutine

在函数Scheduler::CreateTask中

auto cr = std::make_shared(func);

成员变量
std::string name_name=role_attr_.node_name() + "" + role_attr.channel_name();
std::chrono::steady_clock::time_point wake_time_std::chrono::steady_clock::now()
RoutineFunc func_func
RoutineState state_RoutineState::READY
std::atomic_flag lock_ = ATOMIC_FLAG_INIT
std::atomic_flag updated_ = ATOMIC_FLAG_INITtest_and_set(std::memory_order_release)
std::shared_ptr context_context_pool->GetObject()
bool force_stop_ = false
int processor_id_ = -1;
uint32_t priority_ = 0;cr->set_priority(task.prio())
uint64_t id_ = 0;GlobalData::RegisterTaskName(name) ,其中name=role_attr_.node_name() + "" + role_attr.channel_name();
std::string group_name_cr->set_group_name(task.group_name())
static thread_local CRoutine *current_routine_
static thread_local char *main_stack_

class CCObjectPool

成员变量
std::atomic free_head_free_head_.store({0, node_arena_}, std::memory_order_relaxed)
Node *node_arena_ = nullptrstatic_cast<Node *>(CheckedCalloc(capacity_, sizeof(Node)))
uint32_t capacity_ = 0routine_num = 100

class Processor

成员变量
std::shared_ptr context_proc->BindContext(ctx);
std::condition_variable cv_ctx_
std::once_flag thread_flag_
std::mutex mtx_ctx_
std::thread thread_thread_ = std::thread(&Processor::Run, this);
std::atomic<pid_t> tid_{-1}
std::atomic running_{false}

class ProcessorContext

成员变量
bool stop_ = false
alignas(CACHELINE_SIZE) std::atomic_flag notified_ = ATOMIC_FLAG_INIT

class ClassicContext

static constexpr uint32_t MAX_PRIO = 20;

#define DEFAULT_GROUP_NAME “default_grp”

using CROUTINE_QUEUE = std::vector< std::shared_ptr>;

using MULTI_PRIO_QUEUE = std::array<CROUTINE_QUEUE, MAX_PRIO>;

using CR_GROUP = std::unordered_map<std::string, MULTI_PRIO_QUEUE>;

using LOCK_QUEUE = std::array<base::AtomicRWLock, MAX_PRIO>;

using RQ_LOCK_GROUP = std::unordered_map<std::string, LOCK_QUEUE>;

using GRP_WQ_MUTEX = std::unordered_map<std::string, std::mutex>;

using GRP_WQ_CV = std::unordered_map<std::string, std::condition_variable> ;

成员变量
std::string group_name_ctx->SetGroupName(group_name);
alignas(CACHELINE_SIZE) static RQ_LOCK_GROUP rq_locks_ClassicContext::rq_locks_[group_name],在SchedulerClassic::CreateProcessor()函数中
alignas(CACHELINE_SIZE) static CR_GROUP cr_groupClassicContext::cr_group_[group_name] ,在SchedulerClassic::CreateProcessor()中 cr_group_[cr->group_name()].at(cr->priority())
alignas(CACHELINE_SIZE) static GRP_WQ_MUTEX mtx_wq_.emplace_back(cr);ClassicContext::mtx_wq_[group_name]
alignas(CACHELINE_SIZE) static GRP_WQ_CV cv_wq_ClassicContext::cv_wq_[group_name],在SchedulerClassic::CreateProcessor()函数中;cv_wq_[group_name].notify_one(),在void ClassicContext::Notify(const std::string& group_name) 函数中
std::chrono::steady_clock::time_point wake_time_;
bool need_sleep_ = false;

struct RoutineContext

constexpr size_t STACK_SIZE = 8 * 1024 * 1024;

constexpr size_t REGISTERS_SIZE = 56;

成员变量
char stack[STACK_SIZE]
char* sp = nullptr

模块

class AbstractClassFactoryBase

成员变量
std::vector<ClassLoader*> relative_class_loaders_
std::string relative_library_path_
std::string base_class_name_
std::string class_name_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海洋2416

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值