Skip to content

Commit

Permalink
GUACAMOLE-377: Use 2 worker threads per available processor.
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-jumper committed Aug 7, 2024
1 parent d1e4512 commit 4c4fb6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libguac/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
#include <sched.h>
#include <unistd.h>

/**
* The number of worker threads to create per processor.
*/
#define GUAC_DISPLAY_CPU_THREAD_FACTOR 2

/**
* Returns the number of processors available to this process. If possible,
* limits on otherwise available processors like CPU affinity will be taken
Expand Down Expand Up @@ -146,7 +151,7 @@ guac_display* guac_display_alloc(guac_client* client) {
"processor(s) are available.", cpu_count);
}

display->worker_thread_count = cpu_count;
display->worker_thread_count = cpu_count * GUAC_DISPLAY_CPU_THREAD_FACTOR;
display->worker_threads = guac_mem_alloc(display->worker_thread_count, sizeof(pthread_t));
guac_client_log(client, GUAC_LOG_INFO, "Graphical updates will be encoded "
"using %i worker thread(s).", display->worker_thread_count);
Expand Down

0 comments on commit 4c4fb6b

Please sign in to comment.