From 5845a6bcd5b36168bdddeb85da8d8d9d36de7642 Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Fri, 7 Nov 2014 13:44:09 -0800 Subject: [PATCH] uv: revert change causing build failures Revert uv_thread_self() to return unsigned long instead of uv_thread_t. This was causing a build failure on Windows and is only a temporary fix until the proper patch lands upstream. Reverts: https://github.com/joyent/libuv/commit/59658a8 Fixes: ce112c2 "deps: update uv to v1.0.0-rc2" --- deps/uv/Makefile.am | 1 - deps/uv/docs/src/threading.rst | 1 - deps/uv/include/uv.h | 3 +-- deps/uv/src/unix/thread.c | 5 ----- deps/uv/src/uv-common.c | 6 +++--- deps/uv/src/win/thread.c | 5 ----- deps/uv/test/test-list.h | 2 -- deps/uv/test/test-thread-equal.c | 45 ---------------------------------------- deps/uv/uv.gyp | 1 - 9 files changed, 4 insertions(+), 65 deletions(-) delete mode 100644 deps/uv/test/test-thread-equal.c diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index 07d628d..3c6fcb5 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -206,7 +206,6 @@ test_run_tests_SOURCES = test/blackhole-server.c \ test/test-tcp-writealot.c \ test/test-tcp-try-write.c \ test/test-tcp-write-queue-order.c \ - test/test-thread-equal.c \ test/test-thread.c \ test/test-threadpool-cancel.c \ test/test-threadpool.c \ diff --git a/deps/uv/docs/src/threading.rst b/deps/uv/docs/src/threading.rst index 0d6c0df..38daf4e 100644 --- a/deps/uv/docs/src/threading.rst +++ b/deps/uv/docs/src/threading.rst @@ -58,7 +58,6 @@ Threads .. c:function:: int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg) .. c:function:: unsigned long uv_thread_self(void) .. c:function:: int uv_thread_join(uv_thread_t *tid) -.. c:function:: int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) Thread-local storage ^^^^^^^^^^^^^^^^^^^^ diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 9afdc0b..ad6bde9 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -1369,9 +1369,8 @@ UV_EXTERN void uv_key_set(uv_key_t* key, void* value); typedef void (*uv_thread_cb)(void* arg); UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg); -UV_EXTERN uv_thread_t uv_thread_self(void); +UV_EXTERN unsigned long uv_thread_self(void); UV_EXTERN int uv_thread_join(uv_thread_t *tid); -UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2); /* The presence of these unions force similar struct layout. */ #define XX(_, name) uv_ ## name ## _t name; diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c index 00579cb..522426f 100644 --- a/deps/uv/src/unix/thread.c +++ b/deps/uv/src/unix/thread.c @@ -36,11 +36,6 @@ int uv_thread_join(uv_thread_t *tid) { } -int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) { - return pthread_equal(*t1, *t2); -} - - int uv_mutex_init(uv_mutex_t* mutex) { #if defined(NDEBUG) || !defined(PTHREAD_MUTEX_ERRORCHECK) return -pthread_mutex_init(mutex, NULL); diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c index 69fc53a..97727ba 100644 --- a/deps/uv/src/uv-common.c +++ b/deps/uv/src/uv-common.c @@ -306,11 +306,11 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { } -uv_thread_t uv_thread_self(void) { +unsigned long uv_thread_self(void) { #ifdef _WIN32 - return GetCurrentThreadId(); + return (unsigned long) GetCurrentThreadId(); #else - return pthread_self(); + return (unsigned long) pthread_self(); #endif } diff --git a/deps/uv/src/win/thread.c b/deps/uv/src/win/thread.c index 5d8d568..ccc5579 100644 --- a/deps/uv/src/win/thread.c +++ b/deps/uv/src/win/thread.c @@ -129,11 +129,6 @@ int uv_thread_join(uv_thread_t *tid) { } -int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) { - return *t1 == *t2; -} - - int uv_mutex_init(uv_mutex_t* mutex) { InitializeCriticalSection(mutex); return 0; diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index 85ddac8..08ba3f8 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -259,7 +259,6 @@ TEST_DECLARE (thread_local_storage) TEST_DECLARE (thread_mutex) TEST_DECLARE (thread_rwlock) TEST_DECLARE (thread_create) -TEST_DECLARE (thread_equal) TEST_DECLARE (dlerror) TEST_DECLARE (poll_duplex) TEST_DECLARE (poll_unidirectional) @@ -633,7 +632,6 @@ TASK_LIST_START TEST_ENTRY (thread_mutex) TEST_ENTRY (thread_rwlock) TEST_ENTRY (thread_create) - TEST_ENTRY (thread_equal) TEST_ENTRY (dlerror) TEST_ENTRY (ip4_addr) TEST_ENTRY (ip6_addr_link_local) diff --git a/deps/uv/test/test-thread-equal.c b/deps/uv/test/test-thread-equal.c deleted file mode 100644 index 27c07ee..0000000 --- a/deps/uv/test/test-thread-equal.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include "uv.h" -#include "task.h" - -uv_thread_t main_thread_id; -uv_thread_t subthreads[2]; - -static void check_thread(void* arg) { - uv_thread_t *thread_id = arg; - uv_thread_t self_id = uv_thread_self(); - ASSERT(uv_thread_equal(&main_thread_id, &self_id) == 0); - *thread_id = uv_thread_self(); -} - -TEST_IMPL(thread_equal) { - uv_thread_t threads[2]; - main_thread_id = uv_thread_self(); - ASSERT(0 != uv_thread_equal(&main_thread_id, &main_thread_id)); - ASSERT(0 == uv_thread_create(threads + 0, check_thread, subthreads + 0)); - ASSERT(0 == uv_thread_create(threads + 1, check_thread, subthreads + 1)); - ASSERT(0 == uv_thread_join(threads + 0)); - ASSERT(0 == uv_thread_join(threads + 1)); - ASSERT(0 == uv_thread_equal(subthreads + 0, subthreads + 1)); - return 0; -} diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 27885d2..444182b 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -410,7 +410,6 @@ 'test/test-tcp-write-queue-order.c', 'test/test-threadpool.c', 'test/test-threadpool-cancel.c', - 'test/test-thread-equal.c', 'test/test-mutexes.c', 'test/test-thread.c', 'test/test-barrier.c', -- 2.7.4