Changeset: 9cbda85faa1f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9cbda85faa1f
Modified Files:
CMakeLists.txt
common/utils/matomic.h
gdk/gdk_posix.c
gdk/gdk_system.c
gdk/gdk_system.h
monetdb_config.h.in
Branch: cmake-fun
Log Message:
Use WIN32 threads on Windows, and pthreads on UNIX platforms. That's it.
diffs (133 lines):
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -361,7 +361,6 @@ if(NOT WIN32)
endif()
find_package(Threads)
set(THREAD_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
-check_include_file("pthread.h" HAVE_PTHREAD_H) # Distinguish between posix
thread and win32 thread libraries
# Password hash algorithm
set(PASSWORD_BACKEND "SHA512" CACHE STRING "Password hash algorithm, one of
MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384, SHA512, defaults to SHA512")
diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -277,8 +277,6 @@ typedef volatile char ATOMIC_FLAG;
#else
-#include <pthread.h> //required for pthread_mutex_t
-
/* emulate using mutexes */
#include <pthread.h> /* required for pthread_mutex_t */
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -19,7 +19,6 @@
#include "gdk.h" /* includes gdk_posix.h */
#include "gdk_private.h"
#include "mutils.h"
-#include <sys/types.h>
#include <fcntl.h>
#ifdef __MACH__
# include <mach/task.h>
@@ -221,13 +220,11 @@
* this may be around 2000 BATs easily.
*/
-#ifdef HAVE_PTHREAD_H
+#ifndef NATIVE_WIN32
+
#include <sched.h>
#include <pthread.h>
#include <semaphore.h>
-#endif
-
-#ifndef NATIVE_WIN32
void
MT_init_posix(void)
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -160,7 +160,7 @@ GDKlockstatistics(int what)
#endif /* LOCK_STATS */
-#if !defined(HAVE_PTHREAD_H) && defined(WIN32)
+#ifdef WIN32
static struct winthread {
struct winthread *next;
HANDLE hdl;
@@ -466,7 +466,7 @@ MT_kill_thread(MT_Id t)
return -1;
}
-#else /* !defined(HAVE_PTHREAD_H) && defined(_MSC_VER) */
+#else
static struct posthread {
struct posthread *next;
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -73,22 +73,16 @@
#define TEMMASK (1<<10)
#define TEMDEBUG if (GDKdebug & TEMMASK)
-/*
- * @- pthreads Includes and Definitions
- */
-#ifdef HAVE_PTHREAD_H
-#include <sched.h>
-#include <pthread.h>
-#include <semaphore.h>
-#endif
-
#ifdef __MACH__ /* dispatch_semaphore_create function */
#include <dispatch/dispatch.h>
#endif
#ifndef NATIVE_WIN32
-# include <sys/param.h> /* prerequisite of sys/sysctl on OpenBSD */
-# include <sys/sysctl.h>
+#include <sched.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <sys/param.h> /* prerequisite of sys/sysctl on OpenBSD */
+#include <sys/sysctl.h>
#endif
/* debug and errno integers */
@@ -259,7 +253,7 @@ gdk_export int MT_join_thread(MT_Id t);
#ifdef USE_PTHREAD_LOCKS
-#if !defined(HAVE_PTHREAD_H) && defined(WIN32)
+#ifdef WIN32
typedef struct MT_Lock {
HANDLE lock;
char name[16];
@@ -471,7 +465,7 @@ gdk_export ATOMIC_TYPE GDKlocksleepcnt;
/*
* @- MT Semaphore API
*/
-#if !defined(HAVE_PTHREAD_H) && defined(WIN32)
+#ifdef WIN32
typedef struct {
HANDLE sema;
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -183,9 +183,6 @@
/* Define to 1 if the proj library exists */
#cmakedefine HAVE_PROJ 1
-/* Define to 1 if you have the <pthread.h> header file. */
-#cmakedefine HAVE_PTHREAD_H 1
-
/* Define to 1 if you have the `RIPEMD160_Update' function. */
#cmakedefine HAVE_RIPEMD160_UPDATE 1
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list