[Patch] Use internal pthreads reimplementation only when buildingwith MSVC

Поиск
Список
Период
Сортировка
От Sandro Mani
Тема [Patch] Use internal pthreads reimplementation only when buildingwith MSVC
Дата
Msg-id ff533e2c-48a3-3bc2-ca9b-243642c03a8f@gmail.com
обсуждение исходный текст
Ответы Re: [Patch] Use internal pthreads reimplementation only whenbuilding with MSVC
Список pgsql-hackers
Hi

The following patch, which we added to build mingw-postgresql on Fedora, 
makes the internal minimal pthreads reimplementation only used when 
building with MSVC, as on MINGW it causes symbol collisions with the 
symbols provided my winpthreads.

Thanks
Sandro


diff -rupN postgresql-11.5/src/interfaces/ecpg/ecpglib/misc.c 
postgresql-11.5-new/src/interfaces/ecpg/ecpglib/misc.c
--- postgresql-11.5/src/interfaces/ecpg/ecpglib/misc.c 2019-08-05 
23:14:59.000000000 +0200
+++ postgresql-11.5-new/src/interfaces/ecpg/ecpglib/misc.c 2020-04-08 
11:20:39.850738296 +0200
@@ -449,7 +449,7 @@ ECPGis_noind_null(enum ECPGttype type, c
      return false;
  }

-#ifdef WIN32
+#ifdef _MSC_VER
  #ifdef ENABLE_THREAD_SAFETY

  void
diff -rupN 
postgresql-11.5/src/interfaces/ecpg/include/ecpg-pthread-win32.h 
postgresql-11.5-new/src/interfaces/ecpg/include/ecpg-pthread-win32.h
--- postgresql-11.5/src/interfaces/ecpg/include/ecpg-pthread-win32.h 
2019-08-05 23:14:59.000000000 +0200
+++ postgresql-11.5-new/src/interfaces/ecpg/include/ecpg-pthread-win32.h 
2020-04-08 11:20:39.851738296 +0200
@@ -7,7 +7,7 @@

  #ifdef ENABLE_THREAD_SAFETY

-#ifndef WIN32
+#ifndef _MSC_VER

  #include <pthread.h>
  #else
diff -rupN postgresql-11.5/src/interfaces/libpq/fe-connect.c 
postgresql-11.5-new/src/interfaces/libpq/fe-connect.c
--- postgresql-11.5/src/interfaces/libpq/fe-connect.c 2019-08-05 
23:14:59.000000000 +0200
+++ postgresql-11.5-new/src/interfaces/libpq/fe-connect.c 2020-04-08 
11:20:39.853738297 +0200
@@ -50,7 +50,7 @@
  #endif

  #ifdef ENABLE_THREAD_SAFETY
-#ifdef WIN32
+#ifdef _MSC_VER
  #include "pthread-win32.h"
  #else
  #include <pthread.h>
diff -rupN postgresql-11.5/src/interfaces/libpq/fe-secure.c 
postgresql-11.5-new/src/interfaces/libpq/fe-secure.c
--- postgresql-11.5/src/interfaces/libpq/fe-secure.c    2019-08-05 
23:14:59.000000000 +0200
+++ postgresql-11.5-new/src/interfaces/libpq/fe-secure.c 2020-04-08 
11:20:39.854738297 +0200
@@ -48,7 +48,7 @@
  #include <sys/stat.h>

  #ifdef ENABLE_THREAD_SAFETY
-#ifdef WIN32
+#ifdef _MSC_VER
  #include "pthread-win32.h"
  #else
  #include <pthread.h>
diff -rupN postgresql-11.5/src/interfaces/libpq/fe-secure-openssl.c 
postgresql-11.5-new/src/interfaces/libpq/fe-secure-openssl.c
--- postgresql-11.5/src/interfaces/libpq/fe-secure-openssl.c 2019-08-05 
23:14:59.000000000 +0200
+++ postgresql-11.5-new/src/interfaces/libpq/fe-secure-openssl.c 
2020-04-08 11:20:39.855738298 +0200
@@ -47,7 +47,7 @@
  #include <sys/stat.h>

  #ifdef ENABLE_THREAD_SAFETY
-#ifdef WIN32
+#ifdef _MSC_VER
  #include "pthread-win32.h"
  #else
  #include <pthread.h>
diff -rupN postgresql-11.5/src/interfaces/libpq/libpq-int.h 
postgresql-11.5-new/src/interfaces/libpq/libpq-int.h
--- postgresql-11.5/src/interfaces/libpq/libpq-int.h    2019-08-05 
23:14:59.000000000 +0200
+++ postgresql-11.5-new/src/interfaces/libpq/libpq-int.h 2020-04-08 
11:20:39.855738298 +0200
@@ -29,7 +29,7 @@
  #endif

  #ifdef ENABLE_THREAD_SAFETY
-#ifdef WIN32
+#ifdef _MSC_VER
  #include "pthread-win32.h"
  #else
  #include <pthread.h>
diff -rupN postgresql-11.5/src/interfaces/libpq/pthread-win32.c 
postgresql-11.5-new/src/interfaces/libpq/pthread-win32.c
--- postgresql-11.5/src/interfaces/libpq/pthread-win32.c 2019-08-05 
23:14:59.000000000 +0200
+++ postgresql-11.5-new/src/interfaces/libpq/pthread-win32.c 2020-04-08 
11:21:51.674766968 +0200
@@ -10,10 +10,13 @@
  *-------------------------------------------------------------------------
  */

+#ifdef _MSC_VER
+
  #include "postgres_fe.h"

  #include "pthread-win32.h"

+
  DWORD
  pthread_self(void)
  {
@@ -58,3 +61,5 @@ pthread_mutex_unlock(pthread_mutex_t *mp
      LeaveCriticalSection(*mp);
      return 0;
  }
+
+#endif // _MSC_VER




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Sandro Mani
Дата:
Сообщение: [Patch] Add missing libraries to Libs.private of libpq.pc
Следующее
От: Ahsan Hadi
Дата:
Сообщение: Re: 2pc leaks fds