use intptr_t type for pointer->integer conversion so that int <-> pointer sizes match

This commit is contained in:
Hartmut Holzgraefe
2015-02-14 16:39:05 +01:00
parent 3ecf926092
commit 617f44c9c9
2 changed files with 6 additions and 5 deletions

View File

@ -1039,6 +1039,7 @@ int main(int argc, char **argv)
int l; int l;
int i; int i;
int n; int n;
intptr_t thread_id;
int n_threads; /*< number of epoll listener threads */ int n_threads; /*< number of epoll listener threads */
int n_services; int n_services;
int eno = 0; /*< local variable for errno */ int eno = 0; /*< local variable for errno */
@ -1788,9 +1789,9 @@ int main(int argc, char **argv)
/*< /*<
* Start server threads. * Start server threads.
*/ */
for (n = 0; n < n_threads - 1; n++) for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
{ {
threads[n] = thread_start(poll_waitevents, (void *)(n + 1)); threads[thread_id] = thread_start(poll_waitevents, (void *)(thread_id + 1));
} }
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE, LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
"MaxScale started with %d server threads.", "MaxScale started with %d server threads.",
@ -1803,9 +1804,9 @@ int main(int argc, char **argv)
/*< /*<
* Wait server threads' completion. * Wait server threads' completion.
*/ */
for (n = 0; n < n_threads - 1; n++) for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
{ {
thread_wait(threads[n]); thread_wait(threads[thread_id]);
} }
/*< /*<
* Wait the flush thread. * Wait the flush thread.

View File

@ -438,7 +438,7 @@ poll_waitevents(void *arg)
{ {
struct epoll_event events[MAX_EVENTS]; struct epoll_event events[MAX_EVENTS];
int i, nfds, timeout_bias = 1; int i, nfds, timeout_bias = 1;
int thread_id = (int)arg; intptr_t thread_id = (intptr_t)arg;
DCB *zombies = NULL; DCB *zombies = NULL;
int poll_spins = 0; int poll_spins = 0;