comparison seobeo/os/s_linux_edge.c @ 111:48f260576059

[PostDog] Rewriting it from scratch as it is unreadable for me.
author June Park <parkjune1995@gmail.com>
date Sun, 04 Jan 2026 06:39:16 -0800
parents 75de5903355c
children a8976a008a9d
comparison
equal deleted inserted replaced
110:99c4530e4629 111:48f260576059
75 pthread_attr_t attr; 75 pthread_attr_t attr;
76 pthread_attr_init(&attr); 76 pthread_attr_init(&attr);
77 pthread_attr_setstacksize(&attr, 5 * 1024 * 1024); // 5 MB 77 pthread_attr_setstacksize(&attr, 5 * 1024 * 1024); // 5 MB
78 78
79 pthread_t threads[thread_count]; 79 pthread_t threads[thread_count];
80 for (int i = 0; i < thread_count; i++) { 80 for (int i = 0; i < thread_count; i++)
81 {
81 WorkerArgs *args = malloc(sizeof(WorkerArgs)); 82 WorkerArgs *args = malloc(sizeof(WorkerArgs));
82 *args = (WorkerArgs){ p_server_handle, p_html_cache }; 83 *args = (WorkerArgs){ p_server_handle, p_html_cache };
83 84
84 pthread_create(&threads[i], &attr, Seobeo_Web_Edge_Worker, args); 85 pthread_create(&threads[i], &attr, Seobeo_Web_Edge_Worker, args);
85 } 86 }
86 87
87 // Join threads instead of detaching for proper cleanup 88 // Join threads instead of detaching for proper cleanup
88 for (int i = 0; i < thread_count; i++) { 89 for (int i = 0; i < thread_count; i++)
89 pthread_join(threads[i], NULL); 90 pthread_join(threads[i], NULL);
90 }
91 91
92 pthread_attr_destroy(&attr); 92 pthread_attr_destroy(&attr);
93 } 93 }