summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibuv/src/unix/thread.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-22 00:38:46 (GMT)
committerBrad King <brad.king@kitware.com>2017-02-22 00:40:27 (GMT)
commit741b7621b3c71406359d75098f9bdf8d3567662f (patch)
tree67bdab23eb2238c175282a275ec08f2dd9431226 /Utilities/cmlibuv/src/unix/thread.c
parent3ccad39000281c40e2a7a5e078adc4f977e462dd (diff)
parent1f661e87a6a8304edb77bd30b546e5d113477c59 (diff)
downloadCMake-741b7621b3c71406359d75098f9bdf8d3567662f.zip
CMake-741b7621b3c71406359d75098f9bdf8d3567662f.tar.gz
CMake-741b7621b3c71406359d75098f9bdf8d3567662f.tar.bz2
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv: libuv 2017-02-21 (52ae8264)
Diffstat (limited to 'Utilities/cmlibuv/src/unix/thread.c')
-rw-r--r--Utilities/cmlibuv/src/unix/thread.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/Utilities/cmlibuv/src/unix/thread.c b/Utilities/cmlibuv/src/unix/thread.c
index 52989f7..a9b5e4c 100644
--- a/Utilities/cmlibuv/src/unix/thread.c
+++ b/Utilities/cmlibuv/src/unix/thread.c
@@ -40,28 +40,8 @@
#undef NANOSEC
#define NANOSEC ((uint64_t) 1e9)
-struct thread_ctx {
- void (*entry)(void* arg);
- void* arg;
-};
-
-
-static void* uv__thread_start(void *arg)
-{
- struct thread_ctx *ctx_p;
- struct thread_ctx ctx;
-
- ctx_p = arg;
- ctx = *ctx_p;
- uv__free(ctx_p);
- ctx.entry(ctx.arg);
-
- return 0;
-}
-
int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
- struct thread_ctx* ctx;
int err;
pthread_attr_t* attr;
#if defined(__APPLE__)
@@ -69,13 +49,6 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
struct rlimit lim;
#endif
- ctx = uv__malloc(sizeof(*ctx));
- if (ctx == NULL)
- return UV_ENOMEM;
-
- ctx->entry = entry;
- ctx->arg = arg;
-
/* On OSX threads other than the main thread are created with a reduced stack
* size by default, adjust it to RLIMIT_STACK.
*/
@@ -99,14 +72,11 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
attr = NULL;
#endif
- err = pthread_create(tid, attr, uv__thread_start, ctx);
+ err = pthread_create(tid, attr, (void*(*)(void*)) entry, arg);
if (attr != NULL)
pthread_attr_destroy(attr);
- if (err)
- uv__free(ctx);
-
return -err;
}