On Sun, 2010-12-19 at 22:07 +0000, Mateusz Loskot wrote:
> 
> I've tried to apply your patch but I'm not sure it's correct.
> Are you sure you get the Threads_LIBRARIES variable set by CMake?
> It looks to me the FindThreads.cmake sets variables like
> CMAKE_THREAD_LIBS_INIT.
> 
> Would you have updated version of this patch?
> 
> Best regards,

Hi,
an new try for this patch as also on linux the missing direct dependency
on pthread can cause crashes when the backends are loaded dynamically.
When they are unloaded the core loses the pthread linkage from the
database libraries (libmysql, libsqlite3, ...) and can crash.

The patch only links the core with pthread as I guess the core always
outlives the backends, so indirect linkage should be enough.

(the triple check for existing thread library is for cmake 2.6
compatibility)

Best Regards,
Julian Taylor
From 70ccd85c338eee7fd5a3542f680d0a41e34ff059 Mon Sep 17 00:00:00 2001
From: Julian Taylor <[email protected]>
Date: Thu, 30 Dec 2010 23:46:50 +0100
Subject: [PATCH] explicitly link core with thread library

---
 src/core/CMakeLists.txt |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 7c58ee8..31eb667 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -9,12 +9,20 @@
 #
 ################################################################################
 
+include(FindThreads)
+
 colormsg(_HIBLUE_ "Configuring SOCI core library:")
 message(STATUS "")
 
 # Core dependencies
 set(SOCI_CORE_DEPENDENCIES)
 
+if(Threads_FOUND OR CMAKE_USE_WIN32_THREADS_INIT OR CMAKE_THREAD_LIBS_INIT)
+  list(APPEND SOCI_CORE_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT})
+else()
+  message(FATAL_ERROR "No thread library found")
+endif()
+
 if(NOT MSVC)
   set(DL_FIND_QUIETLY TRUE)
   find_package(DL)
-- 
1.7.1

Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to