Repository: mesos Updated Branches: refs/heads/master ab68f9d72 -> cbb209991
Removed ThreadLocal from stout. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8574d0c2 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8574d0c2 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8574d0c2 Branch: refs/heads/master Commit: 8574d0c2b953ed7abf8621b5e3591d4473d91376 Parents: f24db46 Author: Benjamin Hindman <[email protected]> Authored: Fri Jul 24 14:48:22 2015 -0700 Committer: Benjamin Hindman <[email protected]> Committed: Fri Jul 24 15:29:04 2015 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/3rdparty/stout/Makefile.am | 1 - .../3rdparty/stout/include/Makefile.am | 1 - .../3rdparty/stout/include/stout/thread.hpp | 80 -------------------- .../3rdparty/stout/tests/CMakeLists.txt | 3 +- .../3rdparty/stout/tests/thread_tests.cpp | 40 ---------- 5 files changed, 1 insertion(+), 124 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/8574d0c2/3rdparty/libprocess/3rdparty/stout/Makefile.am ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/Makefile.am b/3rdparty/libprocess/3rdparty/stout/Makefile.am index 89e7b18..f95ed03 100644 --- a/3rdparty/libprocess/3rdparty/stout/Makefile.am +++ b/3rdparty/libprocess/3rdparty/stout/Makefile.am @@ -56,6 +56,5 @@ EXTRA_DIST = \ tests/strings_tests.cpp \ tests/subcommand_tests.cpp \ tests/svn_tests.cpp \ - tests/thread_tests.cpp \ tests/uuid_tests.cpp \ tests/version_tests.cpp http://git-wip-us.apache.org/repos/asf/mesos/blob/8574d0c2/3rdparty/libprocess/3rdparty/stout/include/Makefile.am ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am index 5c19e3e..173f18b 100644 --- a/3rdparty/libprocess/3rdparty/stout/include/Makefile.am +++ b/3rdparty/libprocess/3rdparty/stout/include/Makefile.am @@ -84,7 +84,6 @@ nobase_include_HEADERS = \ stout/svn.hpp \ stout/synchronized.hpp \ stout/tests/utils.hpp \ - stout/thread.hpp \ stout/try.hpp \ stout/unreachable.hpp \ stout/utils.hpp \ http://git-wip-us.apache.org/repos/asf/mesos/blob/8574d0c2/3rdparty/libprocess/3rdparty/stout/include/stout/thread.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/thread.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/thread.hpp deleted file mode 100644 index 552d6e9..0000000 --- a/3rdparty/libprocess/3rdparty/stout/include/stout/thread.hpp +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef __STOUT_THREAD_HPP__ -#define __STOUT_THREAD_HPP__ - -#include <errno.h> -#include <pthread.h> -#include <stdio.h> // For perror. - -#include <string> - -#include <stout/abort.hpp> - -template <typename T> -struct ThreadLocal -{ - ThreadLocal() - { - errno = pthread_key_create(&key, NULL); - - if (errno != 0) { - ABORT(std::string("Failed to create thread local, pthread_key_create: ") + - strerror(errno)); - } - } - - ~ThreadLocal() - { - errno = pthread_key_delete(key); - - if (errno != 0) { - ABORT("Failed to destruct thread local, pthread_key_delete: " + - std::string(strerror(errno))); - } - } - - ThreadLocal<T>& operator = (T* t) - { - errno = pthread_setspecific(key, t); - - if (errno != 0) { - ABORT(std::string("Failed to set thread local, pthread_setspecific: ") + - strerror(errno)); - } - return *this; - } - - operator T* () const - { - return reinterpret_cast<T*>(pthread_getspecific(key)); - } - - T* operator -> () const - { - return reinterpret_cast<T*>(pthread_getspecific(key)); - } - -private: - // Not expecting any other operators to be used (and the rest?). - bool operator * (const ThreadLocal<T>&) const; - bool operator == (const ThreadLocal<T>&) const; - bool operator != (const ThreadLocal<T>&) const; - bool operator < (const ThreadLocal<T>&) const; - bool operator > (const ThreadLocal<T>&) const; - - pthread_key_t key; -}; - -#endif // __STOUT_THREAD_HPP__ http://git-wip-us.apache.org/repos/asf/mesos/blob/8574d0c2/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt b/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt index b1a5190..3ed9145 100644 --- a/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt +++ b/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt @@ -54,7 +54,6 @@ set(STOUT_TESTS_SRC some_tests.cpp strings_tests.cpp subcommand_tests.cpp - thread_tests.cpp uuid_tests.cpp version_tests.cpp ) @@ -83,4 +82,4 @@ add_dependencies(${STOUT_TESTS_TARGET} ${STOUT_TEST_DEPENDENCIES}) # ADD TEST TARGET (runs when you do, e.g., `make check`). ######################################################### -add_test(NAME StoutTests COMMAND ./${STOUT_TESTS_TARGET}) \ No newline at end of file +add_test(NAME StoutTests COMMAND ./${STOUT_TESTS_TARGET}) http://git-wip-us.apache.org/repos/asf/mesos/blob/8574d0c2/3rdparty/libprocess/3rdparty/stout/tests/thread_tests.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/3rdparty/stout/tests/thread_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/thread_tests.cpp deleted file mode 100644 index 319fcdf..0000000 --- a/3rdparty/libprocess/3rdparty/stout/tests/thread_tests.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License -*/ - -#include <string> - -#include <gtest/gtest.h> - -#include <stout/thread.hpp> - -TEST(ThreadTest, Local) -{ - ThreadLocal<std::string>* _s_ = new ThreadLocal<std::string>(); - - std::string* s = new std::string(); - - ASSERT_TRUE(*(_s_) == NULL); - - (*_s_) = s; - - ASSERT_TRUE(*(_s_) == s); - ASSERT_FALSE(*(_s_) == NULL); - - (*_s_) = NULL; - - ASSERT_TRUE(*(_s_) == NULL); - - delete s; - delete _s_; -}
