unix: squelch -Wcast-function-type warning

PR-URL: https://github.com/libuv/libuv/pull/2346
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Ben Noordhuis 2019-07-02 11:36:06 +02:00
parent c4ff0457b9
commit a5ffb50dd7

View File

@ -222,6 +222,12 @@ int uv_thread_create_ex(uv_thread_t* tid,
size_t pagesize;
size_t stack_size;
/* Used to squelch a -Wcast-function-type warning. */
union {
void (*in)(void*);
void* (*out)(void*);
} f;
stack_size =
params->flags & UV_THREAD_HAS_STACK_SIZE ? params->stack_size : 0;
@ -248,7 +254,8 @@ int uv_thread_create_ex(uv_thread_t* tid,
abort();
}
err = pthread_create(tid, attr, (void*(*)(void*)) entry, arg);
f.in = entry;
err = pthread_create(tid, attr, f.out, arg);
if (attr != NULL)
pthread_attr_destroy(attr);