MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / post

Method post

smallthinker/tools/server/server.cpp:1567–1583  ·  view source on GitHub ↗

Add a new task to the end of the queue

Source from the content-addressed store, hash-verified

1565
1566 // Add a new task to the end of the queue
1567 int post(server_task && task, bool front = false) {
1568 std::unique_lock<std::mutex> lock(mutex_tasks);
1569 GGML_ASSERT(task.id != -1);
1570 // if this is cancel task make sure to clean up pending tasks
1571 if (task.type == SERVER_TASK_TYPE_CANCEL) {
1572 cleanup_pending_task(task.id_target);
1573 }
1574 const int task_id = task.id;
1575 QUE_DBG("new task, id = %d, front = %d\n", task_id, front);
1576 if (front) {
1577 queue_tasks.push_front(std::move(task));
1578 } else {
1579 queue_tasks.push_back(std::move(task));
1580 }
1581 condition_tasks.notify_one();
1582 return task_id;
1583 }
1584
1585 // multi-task version of post()
1586 int post(std::vector<server_task> && tasks, bool front = false) {

Callers 8

tts-outetts.pyFile · 0.80
cancel_tasksMethod · 0.80
update_slotsMethod · 0.80
mainFunction · 0.80
make_requestMethod · 0.80
make_stream_requestMethod · 0.80
create_completionFunction · 0.80
create_completionFunction · 0.80

Calls 2

push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected