Pithikos / C-Thread-Pool

A minimal but powerful thread pool in ANSI C
MIT License
2.06k stars 603 forks source link

example.c: fix a warning #101

Closed dark-w closed 9 months ago

dark-w commented 3 years ago

i found a grammar warning in the No.20 line of example.c when i used compile option '-Wall -Werror'

dark@ubuntu:~/github/sokoban/points/thread-pool$ make
gcc -Wall -Werror -O2 thpool.c example.c -o thpool -lpthread
example.c: In function ‘task’:
example.c:20:60: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   20 |  printf("Thread #%u working on %d\n", (int)pthread_self(), (int) arg);
      |                                                            ^
cc1: all warnings being treated as errors
make: *** [Makefile:9: thpool] Error 1
dark-w commented 3 years ago

just change to "printf("Thread #%u working on %lu\n", (int)pthread_self(), (size_t)arg);", then all right :)