! * Implementation of TaskQueue interface, which based on Execution * Queue in brpc */
| 32 | * Queue in brpc |
| 33 | */ |
| 34 | class BThreadQueue : public TaskQueue { |
| 35 | public: |
| 36 | //! Disable copy and assigment operator on BThreadQueue instance |
| 37 | // DISALLOW_COPY_AND_ASSIGN(BThreadQueue); |
| 38 | |
| 39 | //! Constructor |
| 40 | BThreadQueue(); |
| 41 | |
| 42 | //! Destructor |
| 43 | ~BThreadQueue() override; |
| 44 | |
| 45 | public: |
| 46 | //! Retrieve id of queue |
| 47 | uint64_t id() const; |
| 48 | |
| 49 | //! Start task queue, return value 0 for success, otherwise failed |
| 50 | int start() override; |
| 51 | |
| 52 | //! Stop task queue, return value 0 for success, otherwise failed |
| 53 | int stop() override; |
| 54 | |
| 55 | //! Join task queue, return value 0 for success, otherwise failed |
| 56 | int join() override; |
| 57 | |
| 58 | //! Put the task in queue |
| 59 | //! @return, 0: succeed, mark status of task as Scheduled |
| 60 | //! other: failed |
| 61 | int put(const TaskPtr &task) override; |
| 62 | |
| 63 | //! Retrieve start flags |
| 64 | bool started() const override; |
| 65 | |
| 66 | private: |
| 67 | //! Release all resourced |
| 68 | void clear_context(); |
| 69 | |
| 70 | private: |
| 71 | //! Identifier of execution queue |
| 72 | bthread::ExecutionQueueId<TaskPtr> queue_id_ = {0}; |
| 73 | |
| 74 | //! Default options for execution queue |
| 75 | bthread::ExecutionQueueOptions options_{}; |
| 76 | |
| 77 | //! Queue status |
| 78 | TaskQueue::Status status_{TaskQueue::Status::INITIALIZED}; |
| 79 | }; |
| 80 | |
| 81 | |
| 82 | } // namespace query |
nothing calls this directly
no outgoing calls
no test coverage detected