Always use builtin JThread library
authorkwolekr <kwolekr@minetest.net>
Mon, 16 Sep 2013 03:00:01 +0000 (23:00 -0400)
committerkwolekr <kwolekr@minetest.net>
Mon, 16 Sep 2013 03:00:01 +0000 (23:00 -0400)
21 files changed:
cmake/Modules/FindJthread.cmake [deleted file]
src/CMakeLists.txt
src/ban.cpp
src/ban.h
src/client.cpp
src/client.h
src/debug.cpp
src/jthread/CMakeLists.txt
src/jthread/jthread.h
src/jthread/pthread/jmutex.cpp
src/jthread/pthread/jthread.cpp
src/jthread/win32/jmutex.cpp
src/jthread/win32/jthread.cpp
src/profiler.h
src/quicktune.cpp
src/script/cpp_api/s_base.h
src/server.cpp
src/settings.h
src/threads.h
src/util/container.h
src/util/thread.h

diff --git a/cmake/Modules/FindJthread.cmake b/cmake/Modules/FindJthread.cmake
deleted file mode 100644 (file)
index 302a3c2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Look for jthread, use our own if not found
-
-FIND_PATH(JTHREAD_INCLUDE_DIR jthread.h)
-
-FIND_LIBRARY(JTHREAD_LIBRARY NAMES jthread)
-
-IF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
-       SET( JTHREAD_FOUND TRUE )
-ENDIF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
-
-IF(JTHREAD_FOUND)
-       MESSAGE(STATUS "Found system jthread header file in ${JTHREAD_INCLUDE_DIR}")
-       MESSAGE(STATUS "Found system jthread library ${JTHREAD_LIBRARY}")
-ELSE(JTHREAD_FOUND)
-       SET(JTHREAD_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/jthread)
-       SET(JTHREAD_LIBRARY jthread)
-       MESSAGE(STATUS "Using project jthread library")
-ENDIF(JTHREAD_FOUND)
index 6a46a823fd275ee20765ec111315bf3fbec6b6d8..937dfab8fe3e09e26be974173ffe5f9d3ecd81af 100644 (file)
@@ -3,7 +3,6 @@ cmake_minimum_required( VERSION 2.6 )
 
 # Set some random things default to not being visible in the GUI
 mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
-mark_as_advanced(JTHREAD_INCLUDE_DIR JTHREAD_LIBRARY)
 mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
 mark_as_advanced(JSON_INCLUDE_DIR JSON_LIBRARY)
 
@@ -169,7 +168,6 @@ else()
        set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
 endif()
 
-find_package(Jthread REQUIRED)
 find_package(Sqlite3 REQUIRED)
 find_package(Json REQUIRED)
 find_package(OpenGLES2)
@@ -225,6 +223,7 @@ configure_file(
        "${PROJECT_BINARY_DIR}/cmake_config.h"
 )
 
+add_subdirectory(jthread)
 add_subdirectory(script)
 add_subdirectory(util)
 
@@ -294,6 +293,7 @@ set(common_SRCS
        serverlist.cpp
        pathfinder.cpp
        convert_json.cpp
+       ${JTHREAD_SRCS}
        ${common_SCRIPT_SRCS}
        ${UTIL_SRCS}
 )
@@ -381,7 +381,6 @@ include_directories(
        ${PNG_INCLUDE_DIR}
        ${GETTEXT_INCLUDE_DIR}
        ${SOUND_INCLUDE_DIRS}
-       ${JTHREAD_INCLUDE_DIR}
        ${SQLITE3_INCLUDE_DIR}
        ${LUA_INCLUDE_DIR}
        ${JSON_INCLUDE_DIR}
@@ -416,7 +415,6 @@ if(BUILD_CLIENT)
                ${X11_LIBRARIES}
                ${GETTEXT_LIBRARY}
                ${SOUND_LIBRARIES}
-               ${JTHREAD_LIBRARY}
                ${SQLITE3_LIBRARY}
                ${LUA_LIBRARY}
                ${JSON_LIBRARY}
@@ -447,7 +445,6 @@ if(BUILD_SERVER)
        target_link_libraries(
                ${PROJECT_NAME}server
                ${ZLIB_LIBRARIES}
-               ${JTHREAD_LIBRARY}
                ${SQLITE3_LIBRARY}
                ${JSON_LIBRARY}
                ${GETTEXT_LIBRARY}
@@ -622,11 +619,6 @@ endif(USE_GETTEXT)
 
 # Subdirectories
 
-if (JTHREAD_FOUND)
-else (JTHREAD_FOUND)
-       add_subdirectory(jthread)
-endif (JTHREAD_FOUND)
-
 if (SQLITE3_FOUND)
 else (SQLITE3_FOUND)
        add_subdirectory(sqlite)
index 5bb470a676f5e6c3a010e50f26cb83990a65614b..50ba0dba1a41b9d4eff4e39023b7586ac90b62b3 100644 (file)
@@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "ban.h"
 #include <fstream>
-#include <jmutexautolock.h>
+#include "jthread/jmutexautolock.h"
 #include <sstream>
 #include <set>
 #include "strfnd.h"
index 529635c266b5f48a0b1aaac31df0bbbce6cf32ad..02a472f51c825bab81fd9536a317d98459b88f7a 100644 (file)
--- a/src/ban.h
+++ b/src/ban.h
@@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include <map>
 #include <string>
-#include <jthread.h>
-#include <jmutex.h>
+#include "jthread/jthread.h"
+#include "jthread/jmutex.h"
 #include "exceptions.h"
 
 class BanManager
index 063dc4158ca2f415c476e4e954a7b82884c5be5b..98c9af972dadb428f74b65e27a00ac715f2c4fdc 100644 (file)
@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "client.h"
 #include <iostream>
 #include "clientserver.h"
-#include "jmutexautolock.h"
+#include "jthread/jmutexautolock.h"
 #include "main.h"
 #include <sstream>
 #include "filesys.h"
index 9146941e8263dbb02f3906d3eaac52f5401671db..9f5eb833bfec872432613e86287971e76f4ca7e6 100644 (file)
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "connection.h"
 #include "environment.h"
 #include "irrlichttypes_extrabloated.h"
-#include "jmutex.h"
+#include "jthread/jmutex.h"
 #include <ostream>
 #include <map>
 #include <set>
index 6bdd1bce55e8e1df910c898b1714afdfb6254b8c..b5bf3f705b772d5a923a31a300adf7c7bb7ef773 100644 (file)
@@ -25,8 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <stdlib.h>
 #include <cstring>
 #include <map>
-#include <jmutex.h>
-#include <jmutexautolock.h>
+#include "jthread/jmutex.h"
+#include "jthread/jmutexautolock.h"
 
 /*
        Debug output
index be38f87f3bcc3ab57dc1bea109b868f9cc7320a7..aa438eaaf636093e7c1809c27686fd73b9d231d8 100644 (file)
@@ -1,16 +1,11 @@
 if( UNIX )
-       set(jthread_SRCS pthread/jmutex.cpp pthread/jthread.cpp)
-       set(jthread_platform_LIBS "")
+       set(JTHREAD_SRCS
+               ${CMAKE_CURRENT_SOURCE_DIR}/pthread/jmutex.cpp
+               ${CMAKE_CURRENT_SOURCE_DIR}/pthread/jthread.cpp
+               PARENT_SCOPE)
 else( UNIX )
-       set(jthread_SRCS win32/jmutex.cpp win32/jthread.cpp)
-       set(jthread_platform_LIBS "")
+       set(JTHREAD_SRCS
+               ${CMAKE_CURRENT_SOURCE_DIR}/win32/jmutex.cpp
+               ${CMAKE_CURRENT_SOURCE_DIR}/win32/jthread.cpp
+               PARENT_SCOPE)
 endif( UNIX )
-
-add_library(jthread ${jthread_SRCS})
-
-target_link_libraries(
-       jthread
-       ${jthread_platform_LIBS}
-)
-
-
index cd78231e9c176c97d68c74b6c3eb40b3ba74242a..ec1eafaeb23dee7ea0a60c322f640c7aef4b572e 100644 (file)
@@ -29,7 +29,7 @@
 
 #define JTHREAD_H
 
-#include "jmutex.h"
+#include "jthread/jmutex.h"
 
 #define ERR_JTHREAD_CANTINITMUTEX                                              -1
 #define ERR_JTHREAD_CANTSTARTTHREAD                                            -2
index 6bc3ae5e2102afe300b98818cefe863c13531e51..29e0baac00d32b1eb871ce36e3edbe540bcdea83 100644 (file)
@@ -25,7 +25,7 @@
 
 */
 
-#include "jmutex.h"
+#include "jthread/jmutex.h"
 
 JMutex::JMutex()
 {
index 4a5c736eb896fdf068a517154af8421779c99304..0ef2508255536000ff86218919fbbc8f33c42f1d 100644 (file)
@@ -25,7 +25,7 @@
 
 */
 
-#include "jthread.h"
+#include "jthread/jthread.h"
 #include <sys/time.h>
 #include <time.h>
 #include <stdlib.h>
index 000461e3b9997068b3eae4ace4f49b8fda42e767..d079d448d70c512596aca7e5373a46bce968e919 100644 (file)
@@ -25,7 +25,7 @@
 
 */
 
-#include "jmutex.h"
+#include "jthread/jmutex.h"
 
 JMutex::JMutex()
 {
index c07425dcad8f38bd893d4f839034fd477c000066..48b83b8949777427731697ea947989bf7d959672 100644 (file)
@@ -25,7 +25,7 @@
 
 */
 
-#include "jthread.h"
+#include "jthread/jthread.h"
 
 #ifndef _WIN32_WCE
        #include <process.h>
index e22a865c070bafce51a9e580cd2a7faa479d38a7..f674b33860fe826be325549dfbae57e847553e19 100644 (file)
@@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "irrlichttypes.h"
 #include <string>
-#include <jmutex.h>
-#include <jmutexautolock.h>
+#include "jthread/jmutex.h"
+#include "jthread/jmutexautolock.h"
 #include <map>
 #include "util/timetaker.h"
 #include "util/numeric.h" // paging()
index d3a7fcae2f8d833e0d65a3b07b5350b1c0bc8fd1..6db72c7276dcc6ab67ca4c75ccbb30661f288b90 100644 (file)
@@ -18,8 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include "quicktune.h"
-#include <jmutex.h>
-#include <jmutexautolock.h>
+#include "jthread/jmutex.h"
+#include "jthread/jmutexautolock.h"
 #include "util/string.h"
 
 std::string QuicktuneValue::getString()
index 3cb59634b01f2b576ea1d8d44667c40899e58a4f..63f7e423fb256e1b953ecdac017119fc8186851d 100644 (file)
@@ -28,8 +28,8 @@ extern "C" {
 }
 
 #include "irrlichttypes.h"
-#include "jmutex.h"
-#include "jmutexautolock.h"
+#include "jthread/jmutex.h"
+#include "jthread/jmutexautolock.h"
 #include "common/c_types.h"
 
 #define SCRIPTAPI_LOCK_DEBUG
index 3bdf9c23d3c3ecaee8636bfa1a138c642e577867..4df2162a7d00c31fd2ecc07586077de0df9786e7 100644 (file)
@@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "ban.h"
 #include "environment.h"
 #include "map.h"
-#include "jmutexautolock.h"
+#include "jthread/jmutexautolock.h"
 #include "main.h"
 #include "constants.h"
 #include "voxel.h"
index 62596f869c9010b9bf47d1ce2a9eeb31aa18743c..4ee5b591322a9070f6bf7b685f034cd823b1e54c 100644 (file)
@@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "irrlichttypes_bloated.h"
 #include "exceptions.h"
 #include <string>
-#include <jmutex.h>
-#include <jmutexautolock.h>
+#include "jthread/jmutex.h"
+#include "jthread/jmutexautolock.h"
 #include "strfnd.h"
 #include <iostream>
 #include <fstream>
index 18789cf0caca5b73d93549a97c50a974547d148a..503fa6abf32f3fa6d9d2f1f1d9e2117f50ca3e88 100644 (file)
@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef THREADS_HEADER
 #define THREADS_HEADER
 
-#include <jmutex.h>
+#include "jthread/jmutex.h"
 
 #if (defined(WIN32) || defined(_WIN32_WCE))
 typedef DWORD threadid_t;
index d5854909ac20fd7359616a3afffd21228185a895..89daa3fbce3ad3753c2c76b22a7272ded9c7e608 100644 (file)
@@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "../irrlichttypes.h"
 #include "../exceptions.h"
-#include <jmutex.h>
-#include <jmutexautolock.h>
+#include "../jthread/jmutex.h"
+#include "../jthread/jmutexautolock.h"
 #include "../porting.h" // For sleep_ms
 #include <list>
 #include <vector>
index 6b2cf5b6c1318d5422cfdd416ac06ecc47cdc209..678d9cf9b059db41314a70229f552d1754f247bb 100644 (file)
@@ -21,9 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define UTIL_THREAD_HEADER
 
 #include "../irrlichttypes.h"
-#include <jthread.h>
-#include <jmutex.h>
-#include <jmutexautolock.h>
+#include "../jthread/jthread.h"
+#include "../jthread/jmutex.h"
+#include "../jthread/jmutexautolock.h"
 
 template<typename T>
 class MutexedVariable