carnold     2005/03/12 22:20:46

  Modified:    .        apr-build.xml apriconv-build.xml aprutil-build.xml
                        build.xml
               examples trivial.cpp
               src      aprinitializer.cpp asyncappender.cpp condition.cpp
                        filewatchdog.cpp loggingevent.cpp mutex.cpp
                        propertyconfigurator.cpp socketappender.cpp
                        socketappenderskeleton.cpp sockethubappender.cpp
                        synchronized.cpp telnetappender.cpp thread.cpp
                        threadspecificdata.cpp xmlsocketappender.cpp
  Log:
  LOGCXX-75: Cygwin build
  
  Revision  Changes    Path
  1.13      +4 -1      logging-log4cxx/apr-build.xml
  
  Index: apr-build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/apr-build.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- apr-build.xml     12 Mar 2005 21:00:37 -0000      1.12
  +++ apr-build.xml     13 Mar 2005 06:20:45 -0000      1.13
  @@ -142,7 +142,10 @@
   </target>
   
   <target name="unix-configure" depends="configure-check" if="is-unix" 
unless="configure-available">
  -        <exec executable="${apr.dir}/configure" dir="${apr.dir}"/>
  +         <!--  shelling to configure allows cygwin to work  -->
  +        <exec executable="sh" dir="${apr.dir}">
  +            <arg value="./configure"/>
  +        </exec>
   </target>
   
   
  
  
  
  1.12      +14 -4     logging-log4cxx/apriconv-build.xml
  
  Index: apriconv-build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/apriconv-build.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apriconv-build.xml        12 Mar 2005 06:37:27 -0000      1.11
  +++ apriconv-build.xml        13 Mar 2005 06:20:45 -0000      1.12
  @@ -42,7 +42,6 @@
   
   <property name="apr.dir" location="${apriconv.dir}/../apr-1.1.0"/>
   <property name="apr.include.dir" location="${apr.dir}/include"/>
  -<property name="with-apr" value="${apr.dir}"/>
   
   <target name="usage" description="Displays usage notes">
           <echo>
  @@ -73,7 +72,7 @@
                          <equals arg1="${os.family}" arg2="windows"/>
                     </or>
                </and>
  -        </condition>
  +        </condition>
   </target>
   
   
  @@ -81,7 +80,7 @@
       <property name="compiler" value="msvc"/>
       <property name="arch" value="win32"/>
       <property name="project.type" value="msvc6"/>
  -    <property name="apriconv.mod.suffix" value=".so"/>
  +    <property name="apriconv.mod.suffix" value=".so"/>
   </target>
   
   <target name="unix-init" depends="os-detect" if="is-unix">
  @@ -95,6 +94,14 @@
       <property name="arch" value="unix"/>
       <property name="project.type" value="cbuilderx"/>
       <property name="apriconv.mod.suffix" value=".so"/>
  +    <!--   
  +        can't use Windows path names if building cygwin   
  +        assuming typical location.
  +    -->
  +    <basename property="with-apr-base" file="${apr.dir}"/>
  +    <condition property="with-apr" value="../${with-apr-base}">
  +        <os family="windows"/>
  +    </condition>
   </target>
   
   <target name="init" depends="win-init, unix-init">
  @@ -134,6 +141,8 @@
           <condition property="project.if" value="true">
               <istrue value="${project.if.value}"/>
           </condition>
  +
  +        <property name="with-apr" value="${apr.dir}"/>
   
   </target>
   
  @@ -160,7 +169,8 @@
   </target>
   
   <target name="unix-configure" depends="configure-check" if="is-unix" 
unless="config-available">
  -        <exec executable="${apriconv.dir}/configure" dir="${apriconv.dir}">
  +        <exec executable="sh" dir="${apriconv.dir}">
  +           <arg value="./configure"/>
              <arg value="--with-apr=${with-apr}"/>
           </exec>
   </target>
  
  
  
  1.14      +22 -5     logging-log4cxx/aprutil-build.xml
  
  Index: aprutil-build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/aprutil-build.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- aprutil-build.xml 12 Mar 2005 06:37:27 -0000      1.13
  +++ aprutil-build.xml 13 Mar 2005 06:20:45 -0000      1.14
  @@ -41,10 +41,8 @@
   
   <property name="apr.dir" location="${aprutil.dir}/../apr-1.1.0"/>
   <property name="apr.include.dir" location="${apr.dir}/include"/>
  -<property name="with-apr" value="${apr.dir}"/>
   <property name="apriconv.dir" location="${aprutil.dir}/../apr-iconv-1.0.1"/>
   <property name="apriconv.include.dir" location="${apriconv.dir}/include"/>
  -<property name="with-apr-iconv" value="${apriconv.dir}"/>
   
   <target name="usage" description="Displays usage notes">
           <echo>
  @@ -92,7 +90,20 @@
               <equals arg1="${compiler}" arg2="g++"/>
           </or>
       </condition>
  -    <property name="arch" value="unix"/>
  +    <property name="arch" value="unix"/>
  +    <!--   
  +        can't use Windows path names if building cygwin   
  +        assuming typical location.
  +    -->
  +    <basename property="with-apr-base" file="${apr.dir}"/>
  +    <condition property="with-apr" value="../${with-apr-base}">
  +        <os family="windows"/>
  +    </condition>
  +    <basename property="with-apr-iconv-base" file="${apriconv.dir}"/>
  +    <condition property="with-apr-iconv" value="../${with-apr-iconv-base}">
  +        <os family="windows"/>
  +    </condition>
  +
   </target>
   
   <target name="init" depends="win-init, unix-init">
  @@ -136,6 +147,9 @@
           <condition property="project.if" value="true">
               <istrue value="${project.if.value}"/>
           </condition>
  +
  +        <property name="with-apr" value="${apr.dir}"/>
  +        <property name="with-apr-iconv" value="${apriconv.dir}"/>
   
   </target>
   
  @@ -170,11 +184,14 @@
   </target>
   
   <target name="unix-configure" depends="configure-check" if="is-unix" 
unless="config-available">
  -        <exec executable="${aprutil.dir}/configure" dir="${aprutil.dir}">
  +        <exec executable="sh" dir="${aprutil.dir}">
  +           <arg value="./configure"/>
              <arg value="--with-apr=${with-apr}"/>
              <arg value="--with-apr-iconv=${with-apr-iconv}"/>
           </exec>
  -        <exec executable="${aprutil.dir}/xml/expat/configure" 
dir="${aprutil.dir}/xml/expat"/>
  +        <exec executable="sh" dir="${aprutil.dir}/xml/expat">
  +            <arg value="./configure"/>
  +        </exec>
   </target>
   
   
  
  
  
  1.53      +23 -5     logging-log4cxx/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/build.xml,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- build.xml 12 Mar 2005 21:00:37 -0000      1.52
  +++ build.xml 13 Mar 2005 06:20:45 -0000      1.53
  @@ -185,6 +185,9 @@
       <condition property="has-expat" value="true">
            <not><isset property="is-mac"/></not>
       </condition>
  +    <condition property="is-cygwin" value="true">
  +        <os family="windows"/>
  +    </condition>
   </target>
   
   
  @@ -324,7 +327,7 @@
           unless="config-available">
   
           <!-- exec executable="configure">
  -            <arg value="- -with-apr=${apr.dir}"/>
  +            <arg value="- -with-apr=${with-apr}"/>
               <arg value="- -with-aprutil=${aprutil.dir}"/>
               <arg value="- -with-apriconv=${apriconv.dir}"/>
               <arg value="- -with-cppunit=${cppunit.dir}"/>
  @@ -403,6 +406,12 @@
           <property name="use-pic" value="${use-pic}"/>
           <property name="os.family" value="${os.family}"/>
       </ant>
  +
  +    <!--  configure can't handle a Windows path   -->
  +    <condition property="with-apr" value="../apr-${apr.version}">
  +         <isset property="is-cygwin"/>
  +    </condition>
  +    <property name="with-apr" location="${apr.dir}"/>
   </target>
   
   <target name="get-apriconv-src" unless="apriconv-src-available">
  @@ -437,13 +446,21 @@
           <property name="apriconv.lib.dir" value="${apriconv.lib.dir}"/>
           <property name="apr.lib.type" value="${apr.lib.type}"/>
           <property name="apriconv.lib.type" value="${apriconv.lib.type}"/>
  -        <property name="with-apr" value="${apr.dir}/apr--config"/>
  +        <property name="with-apr" value="${with-apr}"/>
           <property name="project.type" value="${project.type}"/>
           <property name="project.dir" value="${project.dir}"/>
           <property name="project.if.value" value="${project.if}"/>
           <property name="use-pic" value="${use-pic}"/>
           <property name="os.family" value="${os.family}"/>
       </ant>
  +
  +
  +    <!--  configure can't handle a Windows path   -->
  +    <condition property="with-apr-iconv" 
value="../apr-iconv-${apriconv.version}">
  +         <isset property="is-cygwin"/>
  +    </condition>
  +    <property name="with-apr-iconv" location="${apriconv.dir}"/>
  +
   </target>
   
   <target name="get-aprutil-src" unless="aprutil-src-available">
  @@ -485,7 +502,8 @@
           <property name="apr.lib.type" value="${apr.lib.type}"/>
           <property name="apriconv.lib.type" value="${apriconv.lib.type}"/>
           <property name="aprutil.lib.type" value="${aprutil.lib.type}"/>
  -        <property name="with-apr" value="${apr.dir}/apr--config"/>
  +        <property name="with-apr" value="${with-apr}"/>
  +        <property name="with-apr-iconv" value="${with-apr-iconv}"/>
           <property name="project.type" value="${project.type}"/>
           <property name="project.dir" value="${project.dir}"/>
           <property name="project.if.value" value="${project.if}"/>
  @@ -624,7 +642,7 @@
           <libset libs="advapi32 odbc32 ws2_32" if="is-windows"/>
           <libset libs="stdc++" if="is-gcc"/>
           <libset libs="cw32mt" if="is-bcc"/>
  -        <libset libs="xml2" if="is-unix"/>
  +        <!-- libset libs="xml2" if="is-unix"/ -->
           <libset libs="iconv" if="has-iconv"/>
           <libset libs="${apr.lib.name}${lib-suffix}" dir="${apr.lib.dir}" 
if="apr.lib.dir"/>
           <libset libs="${apr.lib.name}${lib-suffix}" unless="apr.lib.dir"/>
  @@ -909,7 +927,7 @@
           <includepath path="/usr/include/libxml2" if="is-unix"/>
           <includepath path="${apr.include.dir}"/>
           <defineset define="LOG4CXX"/>
  -        <libset libs="xml2" if="is-unix"/>
  +        <!-- libset libs="xml2" if="is-unix"/ -->
           <libset libs="cw32mt" if="is-bcc"/>
   
   
  
  
  
  1.7       +2 -2      logging-log4cxx/examples/trivial.cpp
  
  Index: trivial.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/examples/trivial.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- trivial.cpp       15 Dec 2004 08:10:37 -0000      1.6
  +++ trivial.cpp       13 Mar 2005 06:20:45 -0000      1.7
  @@ -34,10 +34,10 @@
                   NDC::push("trivial context");
   
                   LOG4CXX_DEBUG(rootLogger, "debug message");
  -                LOG4CXX_INFO(rootLogger, L"info message");
  +                LOG4CXX_INFO(rootLogger, "info message");
                   LOG4CXX_WARN(rootLogger, "warn message");
                   LOG4CXX_ERROR(rootLogger, "error message");
  -                LOG4CXX_FATAL(rootLogger, L"fatal message");
  +                LOG4CXX_FATAL(rootLogger, "fatal message");
   
                   NDC::pop();
           }
  
  
  
  1.8       +4 -2      logging-log4cxx/src/aprinitializer.cpp
  
  Index: aprinitializer.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/aprinitializer.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- aprinitializer.cpp        15 Feb 2005 23:56:00 -0000      1.7
  +++ aprinitializer.cpp        13 Mar 2005 06:20:45 -0000      1.8
  @@ -30,9 +30,11 @@
       apr_initialize();
       apr_pool_create(&p, NULL);
       apr_atomic_init(p);
  -    startTime = apr_time_now();
  +    startTime = apr_time_now();
  +#if APR_HAS_THREADS
       apr_status_t stat = apr_threadkey_private_create(&tlsKey, tlsDestruct, 
p);
  -    assert(stat == APR_SUCCESS);
  +    assert(stat == APR_SUCCESS);
  +#endif
   }
   
   APRInitializer::~APRInitializer() {
  
  
  
  1.21      +6 -1      logging-log4cxx/src/asyncappender.cpp
  
  Index: asyncappender.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/asyncappender.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- asyncappender.cpp 12 Mar 2005 21:00:37 -0000      1.20
  +++ asyncappender.cpp 13 Mar 2005 06:20:45 -0000      1.21
  @@ -27,7 +27,10 @@
   
   using namespace log4cxx;
   using namespace log4cxx::helpers;
  -using namespace log4cxx::spi;
  +using namespace log4cxx::spi;
  +
  +#if APR_HAS_THREADS
  +
   
   IMPLEMENT_LOG4CXX_OBJECT(AsyncAppender)
   
  @@ -201,5 +204,7 @@
                   }
           }
   }
  +
  +#endif
   
   
  
  
  
  1.16      +6 -1      logging-log4cxx/src/condition.cpp
  
  Index: condition.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/condition.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- condition.cpp     1 Mar 2005 23:30:44 -0000       1.15
  +++ condition.cpp     13 Mar 2005 06:20:45 -0000      1.16
  @@ -22,7 +22,10 @@
   #include <log4cxx/helpers/pool.h>
   
   using namespace log4cxx::helpers;
  -using namespace log4cxx;
  +using namespace log4cxx;
  +
  +#if APR_HAS_THREADS
  +
   
   Condition::Condition(Pool& p)
   {
  @@ -75,3 +78,5 @@
              throw MutexException(stat);
           }
   }
  +
  +#endif
  
  
  
  1.17      +3 -0      logging-log4cxx/src/filewatchdog.cpp
  
  Index: filewatchdog.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/filewatchdog.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- filewatchdog.cpp  12 Mar 2005 21:00:37 -0000      1.16
  +++ filewatchdog.cpp  13 Mar 2005 06:20:45 -0000      1.17
  @@ -22,6 +22,8 @@
   #include <apr_thread_proc.h>
   #include <apr_atomic.h>
   #include <log4cxx/helpers/transcoder.h>
  +
  +#if APR_HAS_THREADS
   
   
   
  @@ -85,3 +87,4 @@
      thread.run(pool, run, this);
   }
   
  +#endif
  
  
  
  1.28      +5 -1      logging-log4cxx/src/loggingevent.cpp
  
  Index: loggingevent.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/loggingevent.cpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- loggingevent.cpp  15 Feb 2005 23:56:01 -0000      1.27
  +++ loggingevent.cpp  13 Mar 2005 06:20:45 -0000      1.28
  @@ -190,8 +190,12 @@
   }
   
   
  -const LogString LoggingEvent::getCurrentThreadName() {
  +const LogString LoggingEvent::getCurrentThreadName() {
  +#if APR_HAS_THREADS
      return StringHelper::formatHex((const void*) apr_os_thread_current());
  +#else
  +   return LOG4CXX_STR("0x00000000");
  +#endif
   }
   
   void LoggingEvent::read(const helpers::SocketInputStreamPtr& is)
  
  
  
  1.14      +9 -4      logging-log4cxx/src/mutex.cpp
  
  Index: mutex.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/mutex.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mutex.cpp 15 Feb 2005 23:56:01 -0000      1.13
  +++ mutex.cpp 13 Mar 2005 06:20:45 -0000      1.14
  @@ -25,6 +25,7 @@
   
   
   Mutex::Mutex(Pool& p) {
  +#if APR_HAS_THREADS
           apr_thread_mutex_t* aprMutex = NULL;
           apr_status_t stat = apr_thread_mutex_create(&aprMutex,
                   APR_THREAD_MUTEX_NESTED, (apr_pool_t*) p.getAPRPool());
  @@ -32,9 +33,11 @@
                   throw MutexException(stat);
           }
           mutex = aprMutex;
  +#endif
   }
   
   Mutex::Mutex() {
  +#if APR_HAS_THREADS
           apr_thread_mutex_t* aprMutex = NULL;
           apr_status_t stat = apr_thread_mutex_create(&aprMutex,
                   APR_THREAD_MUTEX_NESTED, APRInitializer::getRootPool());
  @@ -42,14 +45,16 @@
                   throw MutexException(stat);
           }
           mutex = aprMutex;
  +#endif
   }
   
   
  -Mutex::~Mutex() {
  -        apr_thread_mutex_destroy((apr_thread_mutex_t*) mutex);
  +Mutex::~Mutex() {
  +#if APR_HAS_THREADS
  +        apr_thread_mutex_destroy((apr_thread_mutex_t*) mutex);
  +#endif
   }
   
  -
   const log4cxx_thread_mutex_t* Mutex::getAPRMutex() const {
       return mutex;
  -}
  +}
  
  
  
  1.20      +11 -5     logging-log4cxx/src/propertyconfigurator.cpp
  
  Index: propertyconfigurator.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/propertyconfigurator.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- propertyconfigurator.cpp  15 Feb 2005 23:56:01 -0000      1.19
  +++ propertyconfigurator.cpp  13 Mar 2005 06:20:45 -0000      1.20
  @@ -28,7 +28,6 @@
   #include <log4cxx/logger.h>
   #include <log4cxx/layout.h>
   #include <log4cxx/config/propertysetter.h>
  -#include <log4cxx/helpers/filewatchdog.h>
   #include <log4cxx/spi/loggerrepository.h>
   #include <log4cxx/helpers/stringtokenizer.h>
   #include <log4cxx/helpers/synchronized.h>
  @@ -43,6 +42,9 @@
   using namespace log4cxx::helpers;
   using namespace log4cxx::config;
   
  +
  +#if APR_HAS_THREADS
  +#include <log4cxx/helpers/filewatchdog.h>
   
   class PropertyWatchdog  : public FileWatchdog
   {
  @@ -61,7 +63,8 @@
                   PropertyConfigurator().doConfigure(file,
                           LogManager::getLoggerRepository());
           }
  -};
  +};
  +#endif
   
   IMPLEMENT_LOG4CXX_OBJECT(PropertyConfigurator)
   
  @@ -103,11 +106,13 @@
   {
           PropertyConfigurator().doConfigure(properties, 
LogManager::getLoggerRepository());
   }
  -
  +
  +#if APR_HAS_THREADS
   void PropertyConfigurator::configureAndWatch(const File& configFilename)
   {
       configureAndWatch(configFilename, FileWatchdog::DEFAULT_DELAY);
  -}
  +}
  +
   
   
   void PropertyConfigurator::configureAndWatch(
  @@ -116,7 +121,8 @@
       PropertyWatchdog * pdog = new PropertyWatchdog(configFilename);
       pdog->setDelay(delay);
       pdog->start();
  -}
  +}
  +#endif
   
   void PropertyConfigurator::doConfigure(helpers::Properties& properties,
           spi::LoggerRepositoryPtr& hierarchy)
  
  
  
  1.17      +4 -1      logging-log4cxx/src/socketappender.cpp
  
  Index: socketappender.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/socketappender.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- socketappender.cpp        15 Feb 2005 23:56:01 -0000      1.16
  +++ socketappender.cpp        13 Mar 2005 06:20:45 -0000      1.17
  @@ -27,7 +27,9 @@
   
   using namespace log4cxx;
   using namespace log4cxx::helpers;
  -using namespace log4cxx::net;
  +using namespace log4cxx::net;
  +
  +#if APR_HAS_THREADS
   
   IMPLEMENT_LOG4CXX_OBJECT(SocketAppender)
   
  @@ -65,3 +67,4 @@
           event->write(os);
   }
   
  +#endif
  
  
  
  1.9       +4 -1      logging-log4cxx/src/socketappenderskeleton.cpp
  
  Index: socketappenderskeleton.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/socketappenderskeleton.cpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- socketappenderskeleton.cpp        12 Mar 2005 21:00:37 -0000      1.8
  +++ socketappenderskeleton.cpp        13 Mar 2005 06:20:45 -0000      1.9
  @@ -31,7 +31,8 @@
   using namespace log4cxx;
   using namespace log4cxx::helpers;
   using namespace log4cxx::net;
  -
  +
  +#if APR_HAS_THREADS
   
   SocketAppenderSkeleton::SocketAppenderSkeleton(int defaultPort, int 
reconnectionDelay)
   :  pool(),
  @@ -246,3 +247,5 @@
           LogLog::debug(LOG4CXX_STR("Exiting Connector.run() method."));
           return NULL;
   }
  +
  +#endif
  
  
  
  1.19      +4 -1      logging-log4cxx/src/sockethubappender.cpp
  
  Index: sockethubappender.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/sockethubappender.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- sockethubappender.cpp     12 Mar 2005 21:00:37 -0000      1.18
  +++ sockethubappender.cpp     13 Mar 2005 06:20:45 -0000      1.19
  @@ -29,7 +29,9 @@
   using namespace log4cxx;
   using namespace log4cxx::helpers;
   using namespace log4cxx::net;
  -using namespace log4cxx::spi;
  +using namespace log4cxx::spi;
  +
  +#if APR_HAS_THREADS
   
   IMPLEMENT_LOG4CXX_OBJECT(SocketHubAppender)
   
  @@ -217,3 +219,4 @@
           return NULL;
   }
   
  +#endif
  
  
  
  1.6       +8 -4      logging-log4cxx/src/synchronized.cpp
  
  Index: synchronized.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/synchronized.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- synchronized.cpp  15 Feb 2005 23:56:01 -0000      1.5
  +++ synchronized.cpp  13 Mar 2005 06:20:45 -0000      1.6
  @@ -25,19 +25,23 @@
   
   synchronized::synchronized(const Mutex& mutex)
   : mutex(mutex.getAPRMutex())
  -{
  +{
  +#if APR_HAS_THREADS
           apr_status_t stat = apr_thread_mutex_lock(
               (apr_thread_mutex_t*) this->mutex);
           if (stat != APR_SUCCESS) {
                   throw MutexException(stat);
  -        }
  +        }
  +#endif
   }
   
   synchronized::~synchronized()
  -{
  +{
  +#if APR_HAS_THREADS
           apr_status_t stat = apr_thread_mutex_unlock(
               (apr_thread_mutex_t*) mutex);
           if (stat != APR_SUCCESS) {
                   throw MutexException(stat);
  -        }
  +        }
  +#endif
   }
  
  
  
  1.18      +3 -0      logging-log4cxx/src/telnetappender.cpp
  
  Index: telnetappender.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/telnetappender.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- telnetappender.cpp        12 Mar 2005 21:00:37 -0000      1.17
  +++ telnetappender.cpp        13 Mar 2005 06:20:45 -0000      1.18
  @@ -27,6 +27,8 @@
   using namespace log4cxx;
   using namespace log4cxx::helpers;
   using namespace log4cxx::net;
  +
  +#if APR_HAS_THREADS
   
   IMPLEMENT_LOG4CXX_OBJECT(TelnetAppender)
   
  @@ -188,6 +190,7 @@
           return NULL;
   }
   
  +#endif
   
   
   
  
  
  
  1.26      +9 -8      logging-log4cxx/src/thread.cpp
  
  Index: thread.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/thread.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- thread.cpp        12 Mar 2005 21:00:37 -0000      1.25
  +++ thread.cpp        13 Mar 2005 06:20:45 -0000      1.26
  @@ -22,14 +22,16 @@
   using namespace log4cxx::helpers;
   using namespace log4cxx;
   
  -
   Thread::Thread() : thread(NULL), finished(false) {
   }
   
  -Thread::~Thread() {
  -        join();
  +Thread::~Thread() {
  +#if APR_HAS_THREADS    
  +    join();
  +#endif
   }
   
  +#if APR_HAS_THREADS
   void Thread::run(log4cxx::helpers::Pool& p,
           void* (LOG4CXX_THREAD_FUNC *start)(log4cxx_thread_t* thread, void* 
data),
           void* data) {
  @@ -48,10 +50,8 @@
           }
   }
   
  -
  -
   void Thread::stop() {
  -        if (thread != NULL && !finished) {
  +    if (thread != NULL && !finished) {
                   apr_status_t stat = apr_thread_exit((apr_thread_t*) thread, 
0);
                   finished = true;
                   thread = NULL;
  @@ -59,7 +59,7 @@
                           throw ThreadException(stat);
                   }
           }
  -}
  +}
   
   void Thread::join() {
           if (thread != NULL && !finished) {
  @@ -70,8 +70,9 @@
                   if (stat != APR_SUCCESS) {
                           throw ThreadException(stat);
                   }
  -        }
  +        }
   }
  +#endif
   
   void Thread::ending() {
           finished = true;
  
  
  
  1.11      +10 -4     logging-log4cxx/src/threadspecificdata.cpp
  
  Index: threadspecificdata.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/threadspecificdata.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- threadspecificdata.cpp    4 Jan 2005 03:37:07 -0000       1.10
  +++ threadspecificdata.cpp    13 Mar 2005 06:20:45 -0000      1.11
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2003,2004 The Apache Software Foundation.
  + * Copyright 2003,2005 The Apache Software Foundation.
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -19,7 +19,8 @@
   #include <log4cxx/helpers/aprinitializer.h>
   #include <log4cxx/helpers/exception.h>
   
  -using namespace log4cxx::helpers;
  +using namespace log4cxx::helpers;
  +
   
   ThreadSpecificData::ThreadSpecificData()
       : ndcStack(), mdcMap() {
  @@ -37,7 +38,8 @@
     return getCurrentData().mdcMap;
   }
   
  -ThreadSpecificData& ThreadSpecificData::getCurrentData() {
  +ThreadSpecificData& ThreadSpecificData::getCurrentData() {
  +#if APR_HAS_THREADS
     void* pData = NULL;
     apr_status_t stat = apr_threadkey_private_get(&pData, 
APRInitializer::getTlsKey());
     if (stat != APR_SUCCESS) {
  @@ -52,5 +54,9 @@
       }
       return *newData;
     }
  -  return *((ThreadSpecificData*) pData);
  +  return *((ThreadSpecificData*) pData);
  +#else
  +  static ThreadSpecificData data;
  +  return data;
  +#endif
   }
  
  
  
  1.15      +5 -0      logging-log4cxx/src/xmlsocketappender.cpp
  
  Index: xmlsocketappender.cpp
  ===================================================================
  RCS file: /home/cvs/logging-log4cxx/src/xmlsocketappender.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- xmlsocketappender.cpp     15 Feb 2005 23:56:01 -0000      1.14
  +++ xmlsocketappender.cpp     13 Mar 2005 06:20:45 -0000      1.15
  @@ -24,6 +24,9 @@
   #include <log4cxx/helpers/transform.h>
   #include <apr_time.h>
   #include <log4cxx/helpers/synchronized.h>
  +
  +
  +#if APR_HAS_THREADS
   
   using namespace log4cxx;
   using namespace log4cxx::helpers;
  @@ -91,4 +94,6 @@
         const LogString& value) {
           SocketAppenderSkeleton::setOption(option, value, DEFAULT_PORT, 
DEFAULT_RECONNECTION_DELAY);
   }
  +
  +#endif
   
  
  
  

Reply via email to