| 208 | } |
| 209 | |
| 210 | bool Server::GetXQueueStatus(XQueueHandle handle, XQueueStatus &status) |
| 211 | { |
| 212 | static std::mutex query_mtx; |
| 213 | std::lock_guard<std::mutex> lock(query_mtx); |
| 214 | |
| 215 | static StatusQuery query(false); // only query XQueue status |
| 216 | query.Reset(); |
| 217 | query.status_.reserve(128); |
| 218 | |
| 219 | auto e = std::make_unique<XQueueQueryEvent>(handle, &query); |
| 220 | XASSERT(self_chan_->Send(e->Data(), e->Size()), "cannot send XQueue query event"); |
| 221 | query.Wait(); |
| 222 | |
| 223 | if (query.status_.empty()) return false; |
| 224 | status = *query.status_[0]; |
| 225 | return true; |
| 226 | } |
| 227 | |
| 228 | void Server::GetXQueue(const httplib::Request &req, httplib::Response &res) |
| 229 | { |