Explorar o código

Fixed 32bit arch warnings when passing the thread id.

default %!s(int64=3) %!d(string=hai) anos
pai
achega
3ba3815b64
Modificáronse 1 ficheiros con 6 adicións e 5 borrados
  1. 6 5
      httpd.c

+ 6 - 5
httpd.c

@@ -293,16 +293,16 @@ void job_wait(xs_val **job)
 static void *job_thread(void *arg)
 static void *job_thread(void *arg)
 /* job thread */
 /* job thread */
 {
 {
-    long long pid = (long long)arg;
+    int pid = (char *) arg - (char *) 0x0;
 
 
-    srv_debug(1, xs_fmt("job thread %ld started", pid));
+    srv_debug(1, xs_fmt("job thread %d started", pid));
 
 
     for (;;) {
     for (;;) {
         xs *job = NULL;
         xs *job = NULL;
 
 
         job_wait(&job);
         job_wait(&job);
 
 
-        srv_debug(1, xs_fmt("job thread %ld wake up", pid));
+        srv_debug(1, xs_fmt("job thread %d wake up", pid));
 
 
         if (job == NULL)
         if (job == NULL)
             break;
             break;
@@ -322,7 +322,7 @@ static void *job_thread(void *arg)
         }
         }
     }
     }
 
 
-    srv_debug(1, xs_fmt("job thread %ld stopped", pid));
+    srv_debug(1, xs_fmt("job thread %d stopped", pid));
 
 
     return NULL;
     return NULL;
 }
 }
@@ -441,8 +441,9 @@ void httpd(void)
     pthread_create(&threads[0], NULL, background_thread, NULL);
     pthread_create(&threads[0], NULL, background_thread, NULL);
 
 
     /* the rest of threads are for job processing */
     /* the rest of threads are for job processing */
+    char *ptr = (char *) 0x1;
     for (n = 1; n < n_threads; n++)
     for (n = 1; n < n_threads; n++)
-        pthread_create(&threads[n], NULL, job_thread, (void *)(long long)n);
+        pthread_create(&threads[n], NULL, job_thread, ptr++);
 
 
     if (setjmp(on_break) == 0) {
     if (setjmp(on_break) == 0) {
         for (;;) {
         for (;;) {