Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unix: don't malloc in uv_thread_create() #1094

Merged
merged 1 commit into from Oct 16, 2016

Conversation

bnoordhuis
Copy link
Member

Simplify and optimize uv_thread_create() by casting the function pointer
to the prototype that pthread_create() wants. Avoids the indirection of
an intermediate callback and heap-allocating custom state that is really
only there to placate the compiler.

CI: https://ci.nodejs.org/job/libuv-test-commit/154/

@saghul
Copy link
Member

saghul commented Oct 14, 2016

Excellent! LGTM if the CI and the compilers are happy.

@agauniyal
Copy link

agauniyal commented Oct 16, 2016

What exactly does this expression means - (void*(*)(void*))?

@saghul
Copy link
Member

saghul commented Oct 16, 2016

A void function which takes a pointer to a void* argument. See: http://man7.org/linux/man-pages/man3/pthread_create.3.html

Simplify and optimize uv_thread_create() by casting the function pointer
to the prototype that pthread_create() wants.  Avoids the indirection of
an intermediate callback and heap-allocating custom state that is really
only there to placate the compiler.

PR-URL: libuv#1094
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
@bnoordhuis bnoordhuis merged commit 3064ae9 into libuv:v1.x Oct 16, 2016
@bnoordhuis bnoordhuis deleted the unix-simplify-thread-create branch October 16, 2016 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants