Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix integer -> pointer cast warnings.

  • Loading branch information...
commit faf3f6443e56a8bf126dcb8ca51eda38142fabb6 1 parent fb9526e
@bnoordhuis authored
Showing with 19 additions and 4 deletions.
  1. +19 −4 l_threads.c
View
23 l_threads.c
@@ -664,8 +664,12 @@ void AddThread(void (*func)(int))
//
thread->threadid = currentthreadid;
- if (pthread_create(&thread->thread, attrib, (pthread_startroutine_t)func, (pthread_addr_t)thread->threadid) == -1)
+ if (pthread_create(&thread->thread,
+ attrib,
+ (pthread_startroutine_t)func,
+ (pthread_addr_t)thread->threadid) == -1) {
Error ("pthread_create failed");
+ }
//add the thread to the end of the list
thread->next = NULL;
@@ -765,9 +769,12 @@ int GetNumThreads(void)
#define USED
+#include <stdint.h>
#include <pthread.h>
#include <semaphore.h>
+#define pthread_startroutine_t void *(*)(void *)
+
typedef struct thread_s
{
pthread_t thread;
@@ -936,10 +943,14 @@ void RunThreadsOn(int workcnt, qboolean showpacifier, void(*func)(int))
for (i=0 ; i<numthreads ; i++)
{
- if (pthread_create(&work_threads[i], NULL, (void *)func, (void *)i) == -1)
+ if (pthread_create(&work_threads[i],
+ NULL,
+ (pthread_startroutine_t)func,
+ (void *)(uintptr_t)i) == -1) {
Error ("pthread_create failed");
+ }
}
-
+
for (i=0 ; i<numthreads ; i++)
{
if (pthread_join(work_threads[i], &pthread_return) == -1)
@@ -983,8 +994,12 @@ void AddThread(void (*func)(int))
//
thread->threadid = currentthreadid;
- if (pthread_create(&thread->thread, NULL, (void *)func, (void *)thread->threadid) == -1)
+ if (pthread_create(&thread->thread,
+ NULL,
+ (pthread_startroutine_t)func,
+ (void *)(uintptr_t)thread->threadid) == -1) {
Error ("pthread_create failed");
+ }
//add the thread to the end of the list
thread->next = NULL;
Please sign in to comment.
Something went wrong with that request. Please try again.