Always use builtin JThread library

This commit is contained in:
kwolekr 2013-09-15 23:00:01 -04:00
parent 3c4734d69a
commit d308352dbd
21 changed files with 37 additions and 68 deletions

@ -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)

@ -3,7 +3,6 @@ cmake_minimum_required( VERSION 2.6 )
# Set some random things default to not being visible in the GUI # Set some random things default to not being visible in the GUI
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) 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(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
mark_as_advanced(JSON_INCLUDE_DIR JSON_LIBRARY) mark_as_advanced(JSON_INCLUDE_DIR JSON_LIBRARY)
@ -169,7 +168,6 @@ else()
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY}) set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
endif() endif()
find_package(Jthread REQUIRED)
find_package(Sqlite3 REQUIRED) find_package(Sqlite3 REQUIRED)
find_package(Json REQUIRED) find_package(Json REQUIRED)
find_package(OpenGLES2) find_package(OpenGLES2)
@ -225,6 +223,7 @@ configure_file(
"${PROJECT_BINARY_DIR}/cmake_config.h" "${PROJECT_BINARY_DIR}/cmake_config.h"
) )
add_subdirectory(jthread)
add_subdirectory(script) add_subdirectory(script)
add_subdirectory(util) add_subdirectory(util)
@ -294,6 +293,7 @@ set(common_SRCS
serverlist.cpp serverlist.cpp
pathfinder.cpp pathfinder.cpp
convert_json.cpp convert_json.cpp
${JTHREAD_SRCS}
${common_SCRIPT_SRCS} ${common_SCRIPT_SRCS}
${UTIL_SRCS} ${UTIL_SRCS}
) )
@ -381,7 +381,6 @@ include_directories(
${PNG_INCLUDE_DIR} ${PNG_INCLUDE_DIR}
${GETTEXT_INCLUDE_DIR} ${GETTEXT_INCLUDE_DIR}
${SOUND_INCLUDE_DIRS} ${SOUND_INCLUDE_DIRS}
${JTHREAD_INCLUDE_DIR}
${SQLITE3_INCLUDE_DIR} ${SQLITE3_INCLUDE_DIR}
${LUA_INCLUDE_DIR} ${LUA_INCLUDE_DIR}
${JSON_INCLUDE_DIR} ${JSON_INCLUDE_DIR}
@ -416,7 +415,6 @@ if(BUILD_CLIENT)
${X11_LIBRARIES} ${X11_LIBRARIES}
${GETTEXT_LIBRARY} ${GETTEXT_LIBRARY}
${SOUND_LIBRARIES} ${SOUND_LIBRARIES}
${JTHREAD_LIBRARY}
${SQLITE3_LIBRARY} ${SQLITE3_LIBRARY}
${LUA_LIBRARY} ${LUA_LIBRARY}
${JSON_LIBRARY} ${JSON_LIBRARY}
@ -447,7 +445,6 @@ if(BUILD_SERVER)
target_link_libraries( target_link_libraries(
${PROJECT_NAME}server ${PROJECT_NAME}server
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${JTHREAD_LIBRARY}
${SQLITE3_LIBRARY} ${SQLITE3_LIBRARY}
${JSON_LIBRARY} ${JSON_LIBRARY}
${GETTEXT_LIBRARY} ${GETTEXT_LIBRARY}
@ -622,11 +619,6 @@ endif(USE_GETTEXT)
# Subdirectories # Subdirectories
if (JTHREAD_FOUND)
else (JTHREAD_FOUND)
add_subdirectory(jthread)
endif (JTHREAD_FOUND)
if (SQLITE3_FOUND) if (SQLITE3_FOUND)
else (SQLITE3_FOUND) else (SQLITE3_FOUND)
add_subdirectory(sqlite) add_subdirectory(sqlite)

@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "ban.h" #include "ban.h"
#include <fstream> #include <fstream>
#include <jmutexautolock.h> #include "jthread/jmutexautolock.h"
#include <sstream> #include <sstream>
#include <set> #include <set>
#include "strfnd.h" #include "strfnd.h"

@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <map> #include <map>
#include <string> #include <string>
#include <jthread.h> #include "jthread/jthread.h"
#include <jmutex.h> #include "jthread/jmutex.h"
#include "exceptions.h" #include "exceptions.h"
class BanManager class BanManager

@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client.h" #include "client.h"
#include <iostream> #include <iostream>
#include "clientserver.h" #include "clientserver.h"
#include "jmutexautolock.h" #include "jthread/jmutexautolock.h"
#include "main.h" #include "main.h"
#include <sstream> #include <sstream>
#include "filesys.h" #include "filesys.h"

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "connection.h" #include "connection.h"
#include "environment.h" #include "environment.h"
#include "irrlichttypes_extrabloated.h" #include "irrlichttypes_extrabloated.h"
#include "jmutex.h" #include "jthread/jmutex.h"
#include <ostream> #include <ostream>
#include <map> #include <map>
#include <set> #include <set>

@ -25,8 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <stdlib.h> #include <stdlib.h>
#include <cstring> #include <cstring>
#include <map> #include <map>
#include <jmutex.h> #include "jthread/jmutex.h"
#include <jmutexautolock.h> #include "jthread/jmutexautolock.h"
/* /*
Debug output Debug output

@ -1,16 +1,11 @@
if( UNIX ) if( UNIX )
set(jthread_SRCS pthread/jmutex.cpp pthread/jthread.cpp) set(JTHREAD_SRCS
set(jthread_platform_LIBS "") ${CMAKE_CURRENT_SOURCE_DIR}/pthread/jmutex.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pthread/jthread.cpp
PARENT_SCOPE)
else( UNIX ) else( UNIX )
set(jthread_SRCS win32/jmutex.cpp win32/jthread.cpp) set(JTHREAD_SRCS
set(jthread_platform_LIBS "") ${CMAKE_CURRENT_SOURCE_DIR}/win32/jmutex.cpp
${CMAKE_CURRENT_SOURCE_DIR}/win32/jthread.cpp
PARENT_SCOPE)
endif( UNIX ) endif( UNIX )
add_library(jthread ${jthread_SRCS})
target_link_libraries(
jthread
${jthread_platform_LIBS}
)

@ -29,7 +29,7 @@
#define JTHREAD_H #define JTHREAD_H
#include "jmutex.h" #include "jthread/jmutex.h"
#define ERR_JTHREAD_CANTINITMUTEX -1 #define ERR_JTHREAD_CANTINITMUTEX -1
#define ERR_JTHREAD_CANTSTARTTHREAD -2 #define ERR_JTHREAD_CANTSTARTTHREAD -2

@ -25,7 +25,7 @@
*/ */
#include "jmutex.h" #include "jthread/jmutex.h"
JMutex::JMutex() JMutex::JMutex()
{ {

@ -25,7 +25,7 @@
*/ */
#include "jthread.h" #include "jthread/jthread.h"
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#include <stdlib.h> #include <stdlib.h>

@ -25,7 +25,7 @@
*/ */
#include "jmutex.h" #include "jthread/jmutex.h"
JMutex::JMutex() JMutex::JMutex()
{ {

@ -25,7 +25,7 @@
*/ */
#include "jthread.h" #include "jthread/jthread.h"
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
#include <process.h> #include <process.h>

@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include <string> #include <string>
#include <jmutex.h> #include "jthread/jmutex.h"
#include <jmutexautolock.h> #include "jthread/jmutexautolock.h"
#include <map> #include <map>
#include "util/timetaker.h" #include "util/timetaker.h"
#include "util/numeric.h" // paging() #include "util/numeric.h" // paging()

@ -18,8 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/ */
#include "quicktune.h" #include "quicktune.h"
#include <jmutex.h> #include "jthread/jmutex.h"
#include <jmutexautolock.h> #include "jthread/jmutexautolock.h"
#include "util/string.h" #include "util/string.h"
std::string QuicktuneValue::getString() std::string QuicktuneValue::getString()

@ -28,8 +28,8 @@ extern "C" {
} }
#include "irrlichttypes.h" #include "irrlichttypes.h"
#include "jmutex.h" #include "jthread/jmutex.h"
#include "jmutexautolock.h" #include "jthread/jmutexautolock.h"
#include "common/c_types.h" #include "common/c_types.h"
#define SCRIPTAPI_LOCK_DEBUG #define SCRIPTAPI_LOCK_DEBUG

@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "ban.h" #include "ban.h"
#include "environment.h" #include "environment.h"
#include "map.h" #include "map.h"
#include "jmutexautolock.h" #include "jthread/jmutexautolock.h"
#include "main.h" #include "main.h"
#include "constants.h" #include "constants.h"
#include "voxel.h" #include "voxel.h"

@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_bloated.h" #include "irrlichttypes_bloated.h"
#include "exceptions.h" #include "exceptions.h"
#include <string> #include <string>
#include <jmutex.h> #include "jthread/jmutex.h"
#include <jmutexautolock.h> #include "jthread/jmutexautolock.h"
#include "strfnd.h" #include "strfnd.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>

@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef THREADS_HEADER #ifndef THREADS_HEADER
#define THREADS_HEADER #define THREADS_HEADER
#include <jmutex.h> #include "jthread/jmutex.h"
#if (defined(WIN32) || defined(_WIN32_WCE)) #if (defined(WIN32) || defined(_WIN32_WCE))
typedef DWORD threadid_t; typedef DWORD threadid_t;

@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "../irrlichttypes.h" #include "../irrlichttypes.h"
#include "../exceptions.h" #include "../exceptions.h"
#include <jmutex.h> #include "../jthread/jmutex.h"
#include <jmutexautolock.h> #include "../jthread/jmutexautolock.h"
#include "../porting.h" // For sleep_ms #include "../porting.h" // For sleep_ms
#include <list> #include <list>
#include <vector> #include <vector>

@ -21,9 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define UTIL_THREAD_HEADER #define UTIL_THREAD_HEADER
#include "../irrlichttypes.h" #include "../irrlichttypes.h"
#include <jthread.h> #include "../jthread/jthread.h"
#include <jmutex.h> #include "../jthread/jmutex.h"
#include <jmutexautolock.h> #include "../jthread/jmutexautolock.h"
template<typename T> template<typename T>
class MutexedVariable class MutexedVariable