THREAD_RV THREAD_CC admin_thread(void* param) { int server = g_create_unix_socket(MANAGEMENT_SOCKET_NAME); g_chmod_hex(MANAGEMENT_SOCKET_NAME, 0xFFFF); log_message(&(g_cfg->log), LOG_LEVEL_INFO, "sesman[admin_thread]: " "Create pool thread"); pool = thread_pool_init_pool(g_cfg->sess.management_thread_count); log_message(&(g_cfg->log), LOG_LEVEL_INFO, "sesman[admin_thread]: " "Start pool thread"); thread_pool_start_pool_thread(pool, thread_routine); xmlInitParser(); while(1) { log_message(&(g_cfg->log), LOG_LEVEL_DEBUG_PLUS, "sesman[admin_thread]: " "wait connection"); int client = g_wait_connection(server); log_message(&(g_cfg->log), LOG_LEVEL_DEBUG_PLUS, "sesman[process_request]: " "New client connection [%i]",client); if (client < 0) { log_message(&(g_cfg->log), LOG_LEVEL_WARNING, "sesman[process_request]: " "Unable to get client from management socket [%s]", strerror(g_get_errno())); continue; } thread_pool_push_job(pool, client); } }
void DEFAULT_CC printerd_main_loop() { int server = g_create_unix_socket(PRINTER_SOCKET_NAME); g_chmod_hex(PRINTER_SOCKET_NAME, 0xFFFF); log_message(l_config, LOG_LEVEL_INFO, "xrdp_printer[printer_main_loop]: " "Create pool thread [%i]", thread_count); pool = thread_pool_init_pool(thread_count); log_message(l_config, LOG_LEVEL_INFO, "xrdp_printer[printer_main_loop]: " "Start pool thread"); thread_pool_start_pool_thread(pool, thread_routine); xmlInitParser(); printer_purge_all(); while (stop == 0) { log_message(l_config, LOG_LEVEL_DEBUG, "xrdp_printer[printer_main_loop]: " "wait connection"); int client = g_wait_connection(server); log_message(l_config, LOG_LEVEL_DEBUG_PLUS, "xrdp_printer[printer_main_loop]: " "New client connection [%i]",client); if (client < 0) { log_message(l_config, LOG_LEVEL_WARNING, "xrdp_printer[printer_main_loop]: " "Unable to get client from management socket [%s]", strerror(g_get_errno())); continue; } thread_pool_push_job(pool, client); } }
/* ------------------------------------------------------------------------- */ struct thread_pool_t* thread_pool_create(uint32_t num_threads, uint32_t buffer_size_in_bytes) { /* create and init thread pool object */ struct thread_pool_t* pool = (struct thread_pool_t*)MALLOC(sizeof(struct thread_pool_t)); thread_pool_init_pool(pool, num_threads, buffer_size_in_bytes); return pool; }
/* ------------------------------------------------------------------------- */ struct thread_pool_t* thread_pool_create(int num_threads) { /* create and init thread pool object */ struct thread_pool_t* pool = (struct thread_pool_t*)MALLOC(sizeof(struct thread_pool_t)); thread_pool_init_pool(pool, num_threads); return pool; }