Skip to content

Commit f24460c

Browse files
committed
update_slots
1 parent e8a4c81 commit f24460c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/server/server.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ struct server_queue {
392392
// callback functions
393393
std::function<void(server_task &)> callback_new_task;
394394
std::function<void(server_task_multi &)> callback_finish_multitask;
395-
std::function<void(void)> callback_run_slots;
395+
std::function<void(void)> callback_update_slots;
396396

397397
// Add a new task to the end of the queue
398398
int post(server_task task) {
@@ -431,8 +431,8 @@ struct server_queue {
431431
}
432432

433433
// Register the function to be called when all slots data is ready to be processed
434-
void on_run_slots(std::function<void(void)> callback) {
435-
callback_run_slots = std::move(callback);
434+
void on_update_slots(std::function<void(void)> callback) {
435+
callback_update_slots = std::move(callback);
436436
}
437437

438438
// Call when the state of one slot is changed
@@ -457,7 +457,7 @@ struct server_queue {
457457
* - Wait until a new task arrives
458458
* - Process the task (i.e. maybe copy data into slot)
459459
* - Check if multitask is finished
460-
* - Run all slots
460+
* - Update all slots
461461
*/
462462
void start_loop() {
463463
running = true;
@@ -495,9 +495,9 @@ struct server_queue {
495495
}
496496

497497
// all tasks in the current loop is processed, slots data is now ready
498-
LOG_VERBOSE("callback_run_slots", {});
498+
LOG_VERBOSE("callback_update_slots", {});
499499

500-
callback_run_slots();
500+
callback_update_slots();
501501

502502
LOG_VERBOSE("wait for new task", {});
503503
{
@@ -1599,7 +1599,7 @@ struct server_context {
15991599
queue_results.send(result);
16001600
}
16011601

1602-
void run_slots() {
1602+
void update_slots() {
16031603
if (system_need_update) {
16041604
system_prompt_update();
16051605
}
@@ -3473,8 +3473,8 @@ int main(int argc, char ** argv) {
34733473
&server_context::process_single_task, &ctx_server, std::placeholders::_1));
34743474
ctx_server.queue_tasks.on_finish_multitask(std::bind(
34753475
&server_context::on_finish_multitask, &ctx_server, std::placeholders::_1));
3476-
ctx_server.queue_tasks.on_run_slots(std::bind(
3477-
&server_context::run_slots, &ctx_server));
3476+
ctx_server.queue_tasks.on_update_slots(std::bind(
3477+
&server_context::update_slots, &ctx_server));
34783478
ctx_server.queue_results.on_multitask_update(std::bind(
34793479
&server_queue::update_multitask,
34803480
&ctx_server.queue_tasks,

0 commit comments

Comments
 (0)