dex5...@gmail.com wrote:
> Thanks for your opinions.
> I solved nanosleep by using floss.
Yep. that should do the trick.
> I post the more detailed diff below again:
>
> ../quickfix/src/C++/Mutex.h
> #else
> m_count = 0;
> ln40- m_threadID = 0;
> ln40+ m_threadID = pthread_self();
> //pthread_mutexattr_t attr;
> #else
> ln63)- if ( m_count && m_threadID==pthread_self() )
> ln63)+ if ( m_count && pthread_equal(m_threadID, pthread_self()) )
> { ++m_count; return ; }
> pthread_mutex_lock( &m_mutex );
> ++m_count;
> m_threadID = pthread_self();
> #endif
>
> #else
> if ( m_count > 1 )
> { m_count--; return ; }
> --m_count;
> ln78)- m_threadID = 0;
> ln78)+ m_threadID = pthread_self();
> pthread_mutex_unlock( &m_mutex );
> #endif
Yes, I found those, still the diff style is a bit strange...
> The other pthread error almost can use the same way to solve.
I apparently gave up too early, it is not that many files that need to get
amended.
> If saw the error like "if(m_threadid)", just add "&" before
> "m_threadid", like this "if(&m_threadid)"
Ah, this was the missing link, I'm getting much further now!
It seems there's now only one file I can't get to compile:
libtool: compile:
c++ -put -DHAVE_CONFIG_H -I. -I../.. -I. -I.. -I../.. -g -I/usr/local/include/libxml2
-c CallStack.cpp -o CallStack.o
return (_Left < _Right);
^
"/usr/include/functional", line 181: error(430): none of the available
operator functions matches these operands
operand types are: const FIX::thread_id < const FIX::thread_id
detected during instantiation of "bool
std::less<_Ty>::operator()(const _Ty &, const _Ty &)
const
[with _Ty=FIX::thread_id]" at line 211 of
"/usr/include/map"
1 error detected in the compilation of "CallStack.cpp".
c89: /usr/cmplr/ccombe exited, returning 2.
No idea how to fix that.
> I still use "conf_script_floss_cc_put" to configure.
> I found it doesn't use "pth" package, it use "/usr/include/pthread.h".
Yep, me too
Bye, Jojo
PS: Here's my full diff output (beware of tabs, spaces and linefeeds):
'cd' into source dir and apply with
/usr/local/bin/patch -p0 -b -z.orig
/usr/local/bin/diff -EBbu ./UnitTest++/Makefile.orig ./UnitTest++/Makefile
--- ./UnitTest++/Makefile.orig 2010-03-25 09:58:41 -0500
+++ ./UnitTest++/Makefile 2012-08-22 02:17:48 -0500
@@ -1,6 +1,6 @@
-CXX = g++
-CXXFLAGS ?= -g -Wall -W -Winline -ansi
-LDFLAGS ?=
+CXX = c++
+CXXFLAGS ?= -g -put
+LDFLAGS ?= -put
SED = sed
MV = mv
RM = rm
@@ -57,7 +57,7 @@
test_dependencies = $(subst .o,.d,$(test_objects))
define make-depend
- $(CXX) $(CXXFLAGS) -M $1 | \
+ $(CXX) $(CXXFLAGS) $1 | \
$(SED) -e 's,\($(notdir $2)\) *:,$(dir $2)\1: ,' > $3.tmp
$(SED) -e 's/#.*//' \
-e 's/^[^:]*: *//' \
@@ -95,7 +95,7 @@
check:
-ifneq "$(MAKECMDGOALS)" "clean"
--include $(dependencies)
--include $(test_dependencies)
-endif
+#ifneq "$(MAKECMDGOALS)" "clean"
+#-include $(dependencies)
+#-include $(test_dependencies)
+#endif
/usr/local/bin/diff -EBbu ./UnitTest++/src/Config.h.orig
./UnitTest++/src/Config.h
--- ./UnitTest++/src/Config.h.orig 2010-01-03 13:09:13 -0600
+++ ./UnitTest++/src/Config.h 2012-08-16 04:11:12 -0500
@@ -15,7 +15,8 @@
#endif
#if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux)
|| \
- defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) ||
define
d(__FreeBSD__)
+ defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__TANDEM)
#define UNITTEST_POSIX
#endif
/usr/local/bin/diff -EBbu ./UnitTest++/src/Posix/SignalTranslator.cpp.orig
./UnitTest++/src/Posix/SignalTranslator.cpp
--- ./UnitTest++/src/Posix/SignalTranslator.cpp.orig 2010-01-03
13:09:13 -0600
+++ ./UnitTest++/src/Posix/SignalTranslator.cpp 2012-08-16 04:19:18 -0500
@@ -26,16 +26,24 @@
sigaction( SIGSEGV, &action, &m_old_SIGSEGV_action );
sigaction( SIGFPE , &action, &m_old_SIGFPE_action );
+#ifdef SIGTRAP
sigaction( SIGTRAP, &action, &m_old_SIGTRAP_action );
+#endif
+#ifdef SIGBUS
sigaction( SIGBUS , &action, &m_old_SIGBUS_action );
+#endif
sigaction( SIGILL , &action, &m_old_SIGBUS_action );
}
SignalTranslator::~SignalTranslator()
{
sigaction( SIGILL , &m_old_SIGBUS_action , 0 );
+#ifdef SIGBUS
sigaction( SIGBUS , &m_old_SIGBUS_action , 0 );
+#endif
+#ifdef SIGTRAP
sigaction( SIGTRAP, &m_old_SIGTRAP_action, 0 );
+#endif
sigaction( SIGFPE , &m_old_SIGFPE_action , 0 );
sigaction( SIGSEGV, &m_old_SIGSEGV_action, 0 );
/usr/local/bin/diff -EBbu ./config/config.sub.orig ./config/config.sub
--- ./config/config.sub.orig 2010-04-05 21:00:24 -0500
+++ ./config/config.sub 2012-08-07 11:34:01 -0500
@@ -823,6 +823,12 @@
np1)
basic_machine=np1-gould
;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
/usr/local/bin/diff -EBbu ./configure.orig ./configure
--- ./configure.orig 2010-04-05 21:00:26 -0500
+++ ./configure 2012-08-16 03:41:03 -0500
@@ -15400,7 +15400,8 @@
# libs
LIBS="$STLPORT_LIBS $XML_LIBS $MYSQL_LIBS $POSTGRESQL_LIBS $LIBS"
# gcc flags
-SHAREDFLAGS="-Wall -ansi -Wpointer-arith -Wwrite-strings $BOOST_CFLAGS
$STLPORT_CFLAGS $MYSQL_CFLAGS $POSTGRESQL_CFLAGS $XML_CPPFLAGS $XML_CFLAGS
$PYTHON_CFLAGS $RUBY_CFLAGS"
+#SHAREDFLAGS="-Wall -ansi -Wpointer-arith -Wwrite-strings $BOOST_CFLAGS
$STLPORT_CFLAGS $MYSQL_CFLAGS $POSTGRESQL_CFLAGS $XML_CPPFLAGS $XML_CFLAGS
$PYTHON_CFLAGS $RUBY_CFLAGS" # __TANDEM: no gcc here!
+SHAREDFLAGS="$BOOST_CFLAGS $STLPORT_CFLAGS $MYSQL_CFLAGS $POSTGRESQL_CFLAGS
$XML_CPPFLAGS $XML_CFLAGS $PYTHON_CFLAGS $RUBY_CFLAGS"
CFLAGS="$CFLAGS $SHAREDFLAGS"
CXXFLAGS="$CXXFLAGS $SHAREDFLAGS"
/usr/local/bin/diff -EBbu ./examples/tradeclientgui/banzai/build.sh.orig
./examples/tradeclientgui/banzai/build.sh
--- ./examples/tradeclientgui/banzai/build.sh.orig 2010-02-23
21:35:39 -0600
+++ ./examples/tradeclientgui/banzai/build.sh 2012-08-16 02:18:07 -0500
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/env bash
WHICH_JAVA=$(which java)
if [ $? != 0 ] ; then
exit 0
/usr/local/bin/diff -EBbu ./src/C++/Acceptor.cpp.orig ./src/C++/Acceptor.cpp
--- ./src/C++/Acceptor.cpp.orig 2012-08-30 04:14:04 -0500
+++ ./src/C++/Acceptor.cpp 2012-08-30 04:13:25 -0500
@@ -38,7 +38,11 @@
MessageStoreFactory& messageStoreFactory,
const SessionSettings& settings )
throw( ConfigError )
+#ifdef __TANDEM
+ : m_threadid( pthread_self() ),
+#else
: m_threadid( 0 ),
+#endif
m_application( application ),
m_messageStoreFactory( messageStoreFactory ),
m_settings( settings ),
@@ -55,7 +59,11 @@
const SessionSettings& settings,
LogFactory& logFactory )
throw( ConfigError )
+#ifdef __TANDEM
+ : m_threadid( pthread_self() ),
+#else
: m_threadid( 0 ),
+#endif
m_application( application ),
m_messageStoreFactory( messageStoreFactory ),
m_settings( settings ),
@@ -243,9 +251,15 @@
m_stop = true;
onStop();
+#ifdef __TANDEM
+ if( &m_threadid )
+ thread_join( m_threadid );
+ m_threadid = pthread_self();
+#else
if( m_threadid )
thread_join( m_threadid );
m_threadid = 0;
+#endif
std::vector<Session*>::iterator session = enabledSessions.begin();
for( ; session != enabledSessions.end(); ++session )
/usr/local/bin/diff -EBbu ./src/C++/CallStack.cpp.orig
./src/C++/CallStack.cpp
--- ./src/C++/CallStack.cpp.orig 2010-02-25 20:05:58 -0600
+++ ./src/C++/CallStack.cpp 2012-08-30 06:11:55 -0500
@@ -68,7 +68,11 @@
{
Context& c = i->second;
if(c.size())
+#ifdef __TANDEM
+ std::cerr << "thread(" << &(i->first) << "):" << c.exception <<
std::endl;
+#else
std::cerr << "thread(" << i->first << "):" << c.exception <<
std::endl;
+#endif
while(c.size())
{
std::cerr << " at " << c.top() << std::endl;
/usr/local/bin/diff -EBbu ./src/C++/HttpServer.cpp.orig
./src/C++/HttpServer.cpp
--- ./src/C++/HttpServer.cpp.orig 2009-02-23 16:57:40 -0600
+++ ./src/C++/HttpServer.cpp 2012-08-30 04:53:12 -0500
@@ -65,7 +65,11 @@
}
HttpServer::HttpServer( const SessionSettings& settings ) throw(
ConfigError )
+#ifdef __TANDEM
+: m_pServer( 0 ), m_settings( settings ), m_threadid( pthread_self() ),
m_port( 0 ), m_stop false ) {}
+#else
: m_pServer( 0 ), m_settings( settings ), m_threadid( 0 ), m_port( 0 ),
m_stop( false ) {}
+#endif
void HttpServer::onConfigure( const SessionSettings& s )
throw ( ConfigError )
@@ -111,9 +115,15 @@
m_stop = true;
onStop();
+#ifdef __TANDEM
+ if( &m_threadid )
+ thread_join( m_threadid );
+ m_threadid = pthread_self();
+#else
if( m_threadid )
thread_join( m_threadid );
m_threadid = 0;
+#endif
QF_STACK_POP
}
/usr/local/bin/diff -EBbu ./src/C++/Initiator.cpp.orig
./src/C++/Initiator.cpp
--- ./src/C++/Initiator.cpp.orig 2010-03-06 20:02:15 -0600
+++ ./src/C++/Initiator.cpp 2012-08-30 04:19:43 -0500
@@ -37,7 +37,11 @@
Initiator::Initiator( Application& application,
MessageStoreFactory& messageStoreFactory,
const SessionSettings& settings ) throw(
ConfigError )
+#ifdef __TANDEM
+: m_threadid( pthread_self() ),
+#else
: m_threadid( 0 ),
+#endif
m_application( application ),
m_messageStoreFactory( messageStoreFactory ),
m_settings( settings ),
@@ -50,7 +54,11 @@
MessageStoreFactory& messageStoreFactory,
const SessionSettings& settings,
LogFactory& logFactory ) throw( ConfigError )
+#ifdef __TANDEM
+: m_threadid( pthread_self() ),
+#else
: m_threadid( 0 ),
+#endif
m_application( application ),
m_messageStoreFactory( messageStoreFactory ),
m_settings( settings ),
@@ -300,9 +308,15 @@
m_stop = true;
onStop();
+#ifdef __TANDEM
+ if( &m_threadid )
+ thread_join( m_threadid );
+ m_threadid = pthread_self();
+#else
if( m_threadid )
thread_join( m_threadid );
m_threadid = 0;
+#endif
std::vector<Session*>::iterator session = enabledSessions.begin();
for( ; session != enabledSessions.end(); ++session )
/usr/local/bin/diff -EBbu ./src/C++/Mutex.h.orig ./src/C++/Mutex.h
--- ./src/C++/Mutex.h.orig 2006-01-26 12:33:35 -0600
+++ ./src/C++/Mutex.h 2012-08-29 04:57:37 -0500
@@ -36,7 +36,11 @@
InitializeCriticalSection( &m_mutex );
#else
m_count = 0;
+#ifdef __TANDEM
+ m_threadID = pthread_self();
+#else
m_threadID = 0;
+#endif
//pthread_mutexattr_t attr;
//pthread_mutexattr_init(&attr);
//pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
@@ -59,7 +63,11 @@
#ifdef _MSC_VER
EnterCriticalSection( &m_mutex );
#else
+#ifdef __TANDEM
+ if ( m_count && pthread_equal(m_threadID, pthread_self()) )
+#else
if ( m_count && m_threadID == pthread_self() )
+#endif
{ ++m_count; return ; }
pthread_mutex_lock( &m_mutex );
++m_count;
@@ -75,7 +83,11 @@
if ( m_count > 1 )
{ m_count--; return ; }
--m_count;
+#ifdef __TANDEM
+ m_threadID = pthread_self();
+#else
m_threadID = 0;
+#endif
pthread_mutex_unlock( &m_mutex );
#endif
}
/usr/local/bin/diff -EBbu ./src/C++/Utility.cpp.orig ./src/C++/Utility.cpp
--- ./src/C++/Utility.cpp.orig 2010-02-27 11:56:42 -0600
+++ ./src/C++/Utility.cpp 2012-08-30 04:57:43 -0500
@@ -35,6 +35,13 @@
#include <algorithm>
#include <fstream>
+#ifdef __TANDEM
+#define _FLOSS_USE_NANOSLEEP
+extern "C" {
+#include <floss.h(floss_nanosleep)>;
+}
+#endif
+
namespace FIX
{
void string_replace( const std::string& oldValue,
@@ -484,7 +491,11 @@
result = _beginthreadex( NULL, 0, &func, var, 0, &id );
if ( result == 0 ) return false;
#else
+#ifdef __TANDEM
+ thread_id result = pthread_self();
+#else
thread_id result = 0;
+#endif
if( pthread_create( &result, 0, func, var ) != 0 ) return false;
#endif
thread = result;
@@ -493,7 +504,11 @@
bool thread_spawn( THREAD_START_ROUTINE func, void* var )
{
+#ifdef __TANDEM
+ thread_id thread = pthread_self();
+#else
thread_id thread = 0;
+#endif
return thread_spawn( func, var, thread );
}