commit 3ba3815

default  ·  2023-02-10 08:07:54 +0000 UTC
parent a92fb94
Fixed 32bit arch warnings when passing the thread id.
1 files changed,  +6, -5
+6, -5
 1@@ -293,16 +293,16 @@ void job_wait(xs_val **job)
 2 static void *job_thread(void *arg)
 3 /* job thread */
 4 {
 5-    long long pid = (long long)arg;
 6+    int pid = (char *) arg - (char *) 0x0;
 7 
 8-    srv_debug(1, xs_fmt("job thread %ld started", pid));
 9+    srv_debug(1, xs_fmt("job thread %d started", pid));
10 
11     for (;;) {
12         xs *job = NULL;
13 
14         job_wait(&job);
15 
16-        srv_debug(1, xs_fmt("job thread %ld wake up", pid));
17+        srv_debug(1, xs_fmt("job thread %d wake up", pid));
18 
19         if (job == NULL)
20             break;
21@@ -322,7 +322,7 @@ static void *job_thread(void *arg)
22         }
23     }
24 
25-    srv_debug(1, xs_fmt("job thread %ld stopped", pid));
26+    srv_debug(1, xs_fmt("job thread %d stopped", pid));
27 
28     return NULL;
29 }
30@@ -441,8 +441,9 @@ void httpd(void)
31     pthread_create(&threads[0], NULL, background_thread, NULL);
32 
33     /* the rest of threads are for job processing */
34+    char *ptr = (char *) 0x1;
35     for (n = 1; n < n_threads; n++)
36-        pthread_create(&threads[n], NULL, job_thread, (void *)(long long)n);
37+        pthread_create(&threads[n], NULL, job_thread, ptr++);
38 
39     if (setjmp(on_break) == 0) {
40         for (;;) {