MCPcopy Create free account
hub / github.com/XpuOS/xsched / Enqueue

Method Enqueue

preempt/src/xqueue/command_buffer.cpp:99–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void CommandBuffer::Enqueue(std::shared_ptr<XCommand> xcmd)
100{
101 auto ready_time = std::chrono::system_clock::now();
102 XASSERT(xcmd != nullptr, "xcmd should not be nullptr");
103 xcmd->SetState(kCommandStatePending);
104
105 mtx_.lock();
106
107 if (xcmd->GetType() == kCommandTypeHardware && xq_state_ == kQueueStateIdle) {
108 xq_state_ = kQueueStateReady;
109 SchedAgent::SendEvent(std::make_shared<XQueueReadyEvent>(kXQueueHandle, ready_time));
110 }
111
112 last_enqueued_cmd_ = xcmd;
113 cmds_.emplace_back(xcmd);
114 XDEBG("xcmd (%p) type (%d) enqueued to cmd buf (%p)", xcmd.get(), xcmd->GetType(), this);
115
116 mtx_.unlock();
117 cv_.notify_all();
118}
119
120void CommandBuffer::DropAll()
121{

Callers 2

~AsyncXQueueMethod · 0.80
SubmitMethod · 0.80

Calls 4

SetStateMethod · 0.80
lockMethod · 0.45
GetTypeMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected