diff options
Diffstat (limited to 'cpp/include/qpid/sys')
-rw-r--r-- | cpp/include/qpid/sys/ExceptionHolder.h | 13 | ||||
-rwxr-xr-x | cpp/include/qpid/sys/IntegerTypes.h | 2 | ||||
-rw-r--r-- | cpp/include/qpid/sys/Runnable.h | 2 | ||||
-rw-r--r-- | cpp/include/qpid/sys/Thread.h | 6 | ||||
-rw-r--r-- | cpp/include/qpid/sys/Time.h | 5 | ||||
-rwxr-xr-x | cpp/include/qpid/sys/windows/IntegerTypes.h | 6 |
6 files changed, 21 insertions, 13 deletions
diff --git a/cpp/include/qpid/sys/ExceptionHolder.h b/cpp/include/qpid/sys/ExceptionHolder.h index 9eff1d64c7..4bc934cf75 100644 --- a/cpp/include/qpid/sys/ExceptionHolder.h +++ b/cpp/include/qpid/sys/ExceptionHolder.h @@ -10,9 +10,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -42,14 +42,11 @@ class ExceptionHolder : public Raisable { public: ExceptionHolder() {} // Use default copy & assign. - + /** Take ownership of ex */ template <class Ex> ExceptionHolder(Ex* ex) { wrap(ex); } - template <class Ex> ExceptionHolder(const boost::shared_ptr<Ex>& ex) { wrap(ex.release()); } - template <class Ex> ExceptionHolder& operator=(Ex* ex) { wrap(ex); return *this; } - template <class Ex> ExceptionHolder& operator=(boost::shared_ptr<Ex> ex) { wrap(ex.release()); return *this; } - + void raise() const { if (wrapper.get()) wrapper->raise() ; } std::string what() const { return wrapper.get() ? wrapper->what() : std::string(); } bool empty() const { return !wrapper.get(); } @@ -66,7 +63,7 @@ class ExceptionHolder : public Raisable { template <class Ex> void wrap(Ex* ex) { wrapper.reset(new Wrapper<Ex>(ex)); } boost::shared_ptr<Raisable> wrapper; }; - + }} // namespace qpid::sys diff --git a/cpp/include/qpid/sys/IntegerTypes.h b/cpp/include/qpid/sys/IntegerTypes.h index 89635f033e..75fa921de0 100755 --- a/cpp/include/qpid/sys/IntegerTypes.h +++ b/cpp/include/qpid/sys/IntegerTypes.h @@ -21,7 +21,7 @@ * */ -#if (defined(_WINDOWS) || defined (WIN32)) && defined(_MSC_VER) +#if (defined(_WINDOWS) || defined (WIN32)) #include "qpid/sys/windows/IntegerTypes.h" #endif #if !defined _WINDOWS && !defined WIN32 diff --git a/cpp/include/qpid/sys/Runnable.h b/cpp/include/qpid/sys/Runnable.h index 0f1243a277..fed7663cb6 100644 --- a/cpp/include/qpid/sys/Runnable.h +++ b/cpp/include/qpid/sys/Runnable.h @@ -30,7 +30,7 @@ namespace sys { /** * Interface for objects that can be run, e.g. in a thread. */ -class Runnable +class QPID_COMMON_CLASS_EXTERN Runnable { public: /** Type to represent a runnable as a Functor */ diff --git a/cpp/include/qpid/sys/Thread.h b/cpp/include/qpid/sys/Thread.h index 45a39e796f..f556612908 100644 --- a/cpp/include/qpid/sys/Thread.h +++ b/cpp/include/qpid/sys/Thread.h @@ -25,7 +25,11 @@ #include "qpid/CommonImportExport.h" #ifdef _WIN32 -# define QPID_TSS __declspec(thread) +# ifdef _MSC_VER +# define QPID_TSS __declspec(thread) +# else +# define QPID_TSS __thread +# endif #elif defined (__GNUC__) # define QPID_TSS __thread #elif defined (__SUNPRO_CC) diff --git a/cpp/include/qpid/sys/Time.h b/cpp/include/qpid/sys/Time.h index d3ab832229..9c5ac66e9a 100644 --- a/cpp/include/qpid/sys/Time.h +++ b/cpp/include/qpid/sys/Time.h @@ -119,7 +119,7 @@ class Duration { friend class AbsTime; public: - QPID_COMMON_EXTERN inline Duration(int64_t time0 = 0); + QPID_COMMON_INLINE_EXTERN inline Duration(int64_t time0 = 0); QPID_COMMON_EXTERN explicit Duration(const AbsTime& start, const AbsTime& finish); inline operator int64_t() const; }; @@ -167,6 +167,9 @@ QPID_COMMON_EXTERN void usleep(uint64_t usecs); /** Output formatted date/time for now*/ void outputFormattedNow(std::ostream&); +/** Output unformatted nanosecond-resolution time for now */ +void outputHiresNow(std::ostream&); + }} #endif /*!_sys_Time_h*/ diff --git a/cpp/include/qpid/sys/windows/IntegerTypes.h b/cpp/include/qpid/sys/windows/IntegerTypes.h index ece1a618e9..28b82da1a0 100755 --- a/cpp/include/qpid/sys/windows/IntegerTypes.h +++ b/cpp/include/qpid/sys/windows/IntegerTypes.h @@ -22,13 +22,17 @@ */ typedef unsigned char uint8_t; -typedef char int8_t; typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned int uint32_t; typedef int int32_t; +#if defined(_MSC_VER) +typedef signed char int8_t; typedef unsigned __int64 uint64_t; typedef __int64 int64_t; +#else +#include <stdint.h> +#endif // Visual Studio doesn't define other common types, so set them up here too. typedef unsigned int uint; |