diff options
Diffstat (limited to 'cpp/include/qpid/sys')
22 files changed, 0 insertions, 1567 deletions
diff --git a/cpp/include/qpid/sys/Condition.h b/cpp/include/qpid/sys/Condition.h deleted file mode 100644 index 9be4b357fe..0000000000 --- a/cpp/include/qpid/sys/Condition.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _sys_Condition_h -#define _sys_Condition_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#ifdef USE_APR_PLATFORM -#include "apr/Condition.h" -#elif defined (_WIN32) -#include "windows/Condition.h" -#else -#include "posix/Condition.h" -#endif - -#endif /*!_sys_Condition_h*/ diff --git a/cpp/include/qpid/sys/ExceptionHolder.h b/cpp/include/qpid/sys/ExceptionHolder.h deleted file mode 100644 index 4bc934cf75..0000000000 --- a/cpp/include/qpid/sys/ExceptionHolder.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef QPID_EXCEPTIONHOLDER_H -#define QPID_EXCEPTIONHOLDER_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <boost/shared_ptr.hpp> - - -namespace qpid { -namespace sys { - -struct Raisable { - virtual ~Raisable() {}; - virtual void raise() const=0; - virtual std::string what() const=0; -}; - -/** - * Holder for exceptions. Allows the thread that notices an error condition to - * create an exception and store it to be thrown by another thread. - */ -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& operator=(Ex* ex) { wrap(ex); 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(); } - operator bool() const { return !empty(); } - void reset() { wrapper.reset(); } - - private: - template <class Ex> struct Wrapper : public Raisable { - Wrapper(Ex* ptr) : exception(ptr) {} - void raise() const { throw *exception; } - std::string what() const { return exception->what(); } - boost::shared_ptr<Ex> exception; - }; - template <class Ex> void wrap(Ex* ex) { wrapper.reset(new Wrapper<Ex>(ex)); } - boost::shared_ptr<Raisable> wrapper; -}; - - -}} // namespace qpid::sys - - -#endif /*!QPID_EXCEPTIONHOLDER_H*/ diff --git a/cpp/include/qpid/sys/IOHandle.h b/cpp/include/qpid/sys/IOHandle.h deleted file mode 100644 index 45fc8c240a..0000000000 --- a/cpp/include/qpid/sys/IOHandle.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _sys_IOHandle_h -#define _sys_IOHandle_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace sys { - -/** - * This is a class intended to abstract the Unix concept of file descriptor - * or the Windows concept of HANDLE - */ -class PollerHandle; -class IOHandlePrivate; -class IOHandle { - friend class PollerHandle; - friend class IOHandlePrivate; - -protected: - IOHandlePrivate* const impl; - - IOHandle(IOHandlePrivate*); - QPID_COMMON_EXTERN virtual ~IOHandle(); -}; - -}} - -#endif // _sys_IOHandle_h diff --git a/cpp/include/qpid/sys/IntegerTypes.h b/cpp/include/qpid/sys/IntegerTypes.h deleted file mode 100755 index 75fa921de0..0000000000 --- a/cpp/include/qpid/sys/IntegerTypes.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef QPID_SYS_INTEGERTYPES_H -#define QPID_SYS_INTEGERTYPES_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#if (defined(_WINDOWS) || defined (WIN32)) -#include "qpid/sys/windows/IntegerTypes.h" -#endif -#if !defined _WINDOWS && !defined WIN32 -#include "qpid/sys/posix/IntegerTypes.h" -#endif - -#endif /*!QPID_SYS_INTEGERTYPES_H*/ diff --git a/cpp/include/qpid/sys/Monitor.h b/cpp/include/qpid/sys/Monitor.h deleted file mode 100644 index 123bf92dcb..0000000000 --- a/cpp/include/qpid/sys/Monitor.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _sys_Monitor_h -#define _sys_Monitor_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/sys/Condition.h" - -namespace qpid { -namespace sys { - -/** - * A monitor is a condition variable and a mutex - */ -class Monitor : public Mutex, public Condition { - public: - inline void wait(); - inline bool wait(const AbsTime& absoluteTime); -}; - - -void Monitor::wait() { - Condition::wait(*this); -} - -bool Monitor::wait(const AbsTime& absoluteTime) { - return Condition::wait(*this, absoluteTime); -} - -}} -#endif /*!_sys_Monitor_h*/ diff --git a/cpp/include/qpid/sys/Mutex.h b/cpp/include/qpid/sys/Mutex.h deleted file mode 100644 index 43a83d4fc3..0000000000 --- a/cpp/include/qpid/sys/Mutex.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _sys_Mutex_h -#define _sys_Mutex_h - -/* - * - * Copyright (c) 2006 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. - * 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 KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -namespace qpid { -namespace sys { - -/** - * Scoped lock template: calls lock() in ctor, unlock() in dtor. - * L can be any class with lock() and unlock() functions. - */ -template <class L> -class ScopedLock -{ - public: - ScopedLock(L& l) : mutex(l) { l.lock(); } - ~ScopedLock() { mutex.unlock(); } - private: - L& mutex; -}; - -template <class L> -class ScopedUnlock -{ - public: - ScopedUnlock(L& l) : mutex(l) { l.unlock(); } - ~ScopedUnlock() { mutex.lock(); } - private: - L& mutex; -}; - -template <class L> -class ScopedRlock -{ - public: - ScopedRlock(L& l) : mutex(l) { l.rlock(); } - ~ScopedRlock() { mutex.unlock(); } - private: - L& mutex; -}; - -template <class L> -class ScopedWlock -{ - public: - ScopedWlock(L& l) : mutex(l) { l.wlock(); } - ~ScopedWlock() { mutex.unlock(); } - private: - L& mutex; -}; - -template <class L> -class ConditionalScopedLock -{ - public: - ConditionalScopedLock(L& l) : mutex(l) { acquired = l.trylock(); } - ~ConditionalScopedLock() { if (acquired) mutex.unlock(); } - bool lockAcquired() { return acquired; } - private: - L& mutex; - bool acquired; -}; - -}} - -#ifdef USE_APR_PLATFORM -#include "apr/Mutex.h" -#elif defined (_WIN32) -#include "windows/Mutex.h" -#else -#include "posix/Mutex.h" -#endif - -#endif /*!_sys_Mutex_h*/ diff --git a/cpp/include/qpid/sys/Runnable.h b/cpp/include/qpid/sys/Runnable.h deleted file mode 100644 index fed7663cb6..0000000000 --- a/cpp/include/qpid/sys/Runnable.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _Runnable_ -#define _Runnable_ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <boost/function.hpp> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace sys { - -/** - * Interface for objects that can be run, e.g. in a thread. - */ -class QPID_COMMON_CLASS_EXTERN Runnable -{ - public: - /** Type to represent a runnable as a Functor */ - typedef boost::function0<void> Functor; - - QPID_COMMON_EXTERN virtual ~Runnable(); - - /** Derived classes override run(). */ - virtual void run() = 0; - - /** Create a functor object that will call this->run(). */ - Functor functor(); -}; - -}} - - -#endif diff --git a/cpp/include/qpid/sys/StrError.h b/cpp/include/qpid/sys/StrError.h deleted file mode 100644 index 36489dd0fc..0000000000 --- a/cpp/include/qpid/sys/StrError.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _sys_StrError_h -#define _sys_StrError_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <string> -#include "qpid/CommonImportExport.h" - -namespace qpid { -namespace sys { - -/** Get the error message for a system number err, e.g. errno. */ -QPID_COMMON_EXTERN std::string strError(int err); - -}} // namespace qpid - -#endif // _sys_StrError_h diff --git a/cpp/include/qpid/sys/SystemInfo.h b/cpp/include/qpid/sys/SystemInfo.h deleted file mode 100644 index 23594cf650..0000000000 --- a/cpp/include/qpid/sys/SystemInfo.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef QPID_SYS_SYSTEMINFO_H -#define QPID_SYS_SYSTEMINFO_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/sys/IntegerTypes.h" -#include "qpid/Address.h" -#include "qpid/CommonImportExport.h" -#include <vector> - -namespace qpid { -namespace sys { - -/** - * Retrieve information about the system we are running on. - * Results may be dependent on OS/hardware. - */ -namespace SystemInfo { - /** - * Estimate available concurrency, e.g. number of CPU cores. - * -1 means estimate not available on this platform. - */ - QPID_COMMON_EXTERN long concurrency(); - - /** - * Get the local host name and set it in the specified. - * Returns false if it can't be obtained and sets errno to any error value. - */ - QPID_COMMON_EXTERN bool getLocalHostname (Address &address); - - QPID_COMMON_EXTERN void getLocalIpAddresses (uint16_t port, std::vector<Address> &addrList); - - /** - * Retrieve system identifiers and versions. This is information that can - * generally be retrieved via POSIX uname(). - * - * @param osName Receives the OS name; e.g., GNU/Linux or Windows - * @param nodeName Receives the nodename. This may or may not match the - * set hostname from getLocalHostname(). - * @param release Receives the OS release identifier. - * @param version Receives the OS release version (kernel, build, sp, etc.) - * @param machine Receives the hardware type. - */ - QPID_COMMON_EXTERN void getSystemId (std::string &osName, - std::string &nodeName, - std::string &release, - std::string &version, - std::string &machine); - - /** - * Get the process ID of the current process. - */ - QPID_COMMON_EXTERN uint32_t getProcessId(); - - /** - * Get the process ID of the parent of the current process. - */ - QPID_COMMON_EXTERN uint32_t getParentProcessId(); - - /** - * Get the name of the current process (i.e. the name of the executable) - */ - QPID_COMMON_EXTERN std::string getProcessName(); - - -}}} // namespace qpid::sys::SystemInfo - -#endif /*!QPID_SYS_SYSTEMINFO_H*/ diff --git a/cpp/include/qpid/sys/Thread.h b/cpp/include/qpid/sys/Thread.h deleted file mode 100644 index f556612908..0000000000 --- a/cpp/include/qpid/sys/Thread.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _sys_Thread_h -#define _sys_Thread_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include <boost/shared_ptr.hpp> -#include "qpid/CommonImportExport.h" - -#ifdef _WIN32 -# 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) -# define QPID_TSS __thread -#else -# error "Dont know how to define QPID_TSS for this platform" -#endif - -namespace qpid { -namespace sys { - -class Runnable; -class ThreadPrivate; - -class Thread -{ - boost::shared_ptr<ThreadPrivate> impl; - - public: - QPID_COMMON_EXTERN Thread(); - QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable*); - QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable&); - - QPID_COMMON_EXTERN operator bool(); - QPID_COMMON_EXTERN bool operator==(const Thread&) const; - QPID_COMMON_EXTERN bool operator!=(const Thread&) const; - - QPID_COMMON_EXTERN void join(); - - QPID_COMMON_EXTERN static Thread current(); - - /** ID of current thread for logging. - * Workaround for broken Thread::current() in APR - */ - QPID_COMMON_EXTERN static unsigned long logId(); -}; - -}} -#endif /*!_sys_Thread_h*/ diff --git a/cpp/include/qpid/sys/Time.h b/cpp/include/qpid/sys/Time.h deleted file mode 100644 index 9c5ac66e9a..0000000000 --- a/cpp/include/qpid/sys/Time.h +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef _sys_Time_h -#define _sys_Time_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/sys/IntegerTypes.h" -/* - * The platform defines its notion of time as a TimePrivate type. The - * platform's implementation knows how to handle this type. - */ -#if defined (_WIN32) -# include "windows/Time.h" -#else -# include "posix/Time.h" -#endif - -#include "qpid/CommonImportExport.h" - -#include <limits> -#include <iosfwd> - -namespace qpid { -namespace sys { - -class Duration; - -/** - * @class AbsTime - * - * Class to represent an instant in time. - * - * The time resolution is in nanosecs, and this is held with 64 bits - * giving a total time span from about 25 million years ago to 25 million - * years hence. As an aside the internal time can sensibly be negative - * meaning before the epoch (probably 1/1/1970 although this class doesn't - * care). - * - * The AbsTime class is a value class and so you don't need to add any - * accessors to its internal state. If you think you want to replace its value, - * you need to construct a new AbsTime and assign it, viz: - * - * AbsTime when = now(); - * ... - * when = AbsTime(when, 2*TIME_SEC); // Advance timer 2 secs - * - * AbsTime is not intended to be used to represent calendar dates/times - * but you can construct a Duration since the Unix Epoch, 1970-1-1-00:00, - * so that you can convert to a date/time if needed: - * - * int64_t nanosec_since_epoch = Duration(EPOCH, now()); - * - * There are some sensible operations that are currently missing from - * AbsTime, but nearly all that's needed can be done with a mixture of - * AbsTimes and Durations. - * - * For example, convenience operators to add a Duration and AbsTime returning - * an AbsTime would fit here (although you can already perform the operation - * with one of the AbsTime constructors). However trying to add 2 AbsTimes - * doesn't make sense. - */ -class AbsTime { - friend class Duration; - friend class Condition; - - TimePrivate timepoint; - -public: - - inline AbsTime() : timepoint() {} - QPID_COMMON_EXTERN AbsTime(const AbsTime& time0, const Duration& duration); - // Default assignment operation fine - // Default copy constructor fine - - QPID_COMMON_EXTERN static AbsTime now(); - QPID_COMMON_EXTERN static AbsTime FarFuture(); - QPID_COMMON_EXTERN static AbsTime Epoch(); - - bool operator==(const AbsTime& t) const { return t.timepoint == timepoint; } - - friend bool operator<(const AbsTime& a, const AbsTime& b); - friend bool operator>(const AbsTime& a, const AbsTime& b); - QPID_COMMON_EXTERN friend std::ostream& operator << (std::ostream&, const AbsTime&); -}; - -QPID_COMMON_EXTERN std::ostream& operator << (std::ostream&, const AbsTime&); - -/** - * @class Duration - * Class to represent the duration between instants of time. - * - * As AbsTime, this class also uses nanosecs for its time - * resolution where possible. For the most part a duration can be dealt - * with like a 64 bit integer, and indeed there is an implicit conversion which - * makes this quite convenient. - */ -class Duration { - static int64_t max() { return std::numeric_limits<int64_t>::max(); } - int64_t nanosecs; - - friend class AbsTime; - -public: - 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; -}; - -std::ostream& operator << (std::ostream&, const Duration&); - -inline AbsTime now() { return AbsTime::now(); } - -inline bool operator<(const AbsTime& a, const AbsTime& b) -{ return a.timepoint < b.timepoint; } -inline bool operator>(const AbsTime& a, const AbsTime& b) -{ return a.timepoint > b.timepoint; } - -Duration::Duration(int64_t time0) : - nanosecs(time0) -{} - -Duration::operator int64_t() const -{ return nanosecs; } - -/** Nanoseconds per second. */ -const Duration TIME_SEC = 1000*1000*1000; -/** Nanoseconds per millisecond */ -const Duration TIME_MSEC = 1000*1000; -/** Nanoseconds per microseconds. */ -const Duration TIME_USEC = 1000; -/** Nanoseconds per nanosecond. */ -const Duration TIME_NSEC = 1; - -/** Value to represent an infinite timeout */ -const Duration TIME_INFINITE = std::numeric_limits<int64_t>::max(); - -/** Absolute time point for the Unix epoch: 1970-01-01T00:00:00 */ -const AbsTime EPOCH = AbsTime::Epoch(); - -/** Time greater than any other time */ -const AbsTime FAR_FUTURE = AbsTime::FarFuture(); - -/** Portable sleep for a number of seconds */ -QPID_COMMON_EXTERN void sleep(int secs); - -/** Portable sleep for a number of microseconds */ -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/posix/Condition.h b/cpp/include/qpid/sys/posix/Condition.h deleted file mode 100644 index 36e7557ffd..0000000000 --- a/cpp/include/qpid/sys/posix/Condition.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _sys_posix_Condition_h -#define _sys_posix_Condition_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/sys/posix/PrivatePosix.h" - -#include "qpid/sys/Mutex.h" -#include "qpid/sys/Time.h" - -#include <time.h> -#include <sys/errno.h> -#include <boost/noncopyable.hpp> - -namespace qpid { -namespace sys { - -/** - * A condition variable for thread synchronization. - */ -class Condition -{ - public: - inline Condition(); - inline ~Condition(); - inline void wait(Mutex&); - inline bool wait(Mutex&, const AbsTime& absoluteTime); - inline void notify(); - inline void notifyAll(); - - private: - pthread_cond_t condition; -}; - -Condition::Condition() { - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_init(&condition, 0)); -} - -Condition::~Condition() { - QPID_POSIX_ABORT_IF(pthread_cond_destroy(&condition)); -} - -void Condition::wait(Mutex& mutex) { - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_wait(&condition, &mutex.mutex)); -} - -bool Condition::wait(Mutex& mutex, const AbsTime& absoluteTime){ - struct timespec ts; - toTimespec(ts, Duration(EPOCH, absoluteTime)); - int status = pthread_cond_timedwait(&condition, &mutex.mutex, &ts); - if (status != 0) { - if (status == ETIMEDOUT) return false; - throw QPID_POSIX_ERROR(status); - } - return true; -} - -void Condition::notify(){ - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_signal(&condition)); -} - -void Condition::notifyAll(){ - QPID_POSIX_ASSERT_THROW_IF(pthread_cond_broadcast(&condition)); -} - -}} -#endif /*!_sys_posix_Condition_h*/ diff --git a/cpp/include/qpid/sys/posix/IntegerTypes.h b/cpp/include/qpid/sys/posix/IntegerTypes.h deleted file mode 100755 index ce97f7bde8..0000000000 --- a/cpp/include/qpid/sys/posix/IntegerTypes.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef QPID_SYS_POSIX_INTEGERTYPES_H -#define QPID_SYS_POSIX_INTEGERTYPES_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <stdint.h> - -#endif /*!QPID_SYS_INTEGERTYPES_H*/ diff --git a/cpp/include/qpid/sys/posix/Mutex.h b/cpp/include/qpid/sys/posix/Mutex.h deleted file mode 100644 index e2b21b5a56..0000000000 --- a/cpp/include/qpid/sys/posix/Mutex.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef _sys_posix_Mutex_h -#define _sys_posix_Mutex_h - -/* - * - * Copyright (c) 2006 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. - * 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 KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "qpid/sys/posix/check.h" - -#include <pthread.h> -#include <boost/noncopyable.hpp> - -namespace qpid { -namespace sys { - -class Condition; - -/** - * Mutex lock. - */ -class Mutex : private boost::noncopyable { - friend class Condition; - static const pthread_mutexattr_t* getAttribute(); - -public: - typedef ::qpid::sys::ScopedLock<Mutex> ScopedLock; - typedef ::qpid::sys::ScopedUnlock<Mutex> ScopedUnlock; - - inline Mutex(); - inline ~Mutex(); - inline void lock(); - inline void unlock(); - inline bool trylock(); - - -protected: - pthread_mutex_t mutex; -}; - -/** - * RW lock. - */ -class RWlock : private boost::noncopyable { - friend class Condition; - -public: - typedef ::qpid::sys::ScopedRlock<RWlock> ScopedRlock; - typedef ::qpid::sys::ScopedWlock<RWlock> ScopedWlock; - - inline RWlock(); - inline ~RWlock(); - inline void wlock(); // will write-lock - inline void rlock(); // will read-lock - inline void unlock(); - inline void trywlock(); // will write-try - inline void tryrlock(); // will read-try - -protected: - pthread_rwlock_t rwlock; -}; - - -/** - * PODMutex is a POD, can be static-initialized with - * PODMutex m = QPID_PODMUTEX_INITIALIZER - */ -struct PODMutex -{ - typedef ::qpid::sys::ScopedLock<PODMutex> ScopedLock; - - inline void lock(); - inline void unlock(); - inline bool trylock(); - - // Must be public to be a POD: - pthread_mutex_t mutex; -}; - -#define QPID_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER } - -void PODMutex::lock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_lock(&mutex)); -} - -void PODMutex::unlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_unlock(&mutex)); -} - -bool PODMutex::trylock() { - return pthread_mutex_trylock(&mutex) == 0; -} - -Mutex::Mutex() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_init(&mutex, getAttribute())); -} - -Mutex::~Mutex(){ - QPID_POSIX_ABORT_IF(pthread_mutex_destroy(&mutex)); -} - -void Mutex::lock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_lock(&mutex)); -} - -void Mutex::unlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_mutex_unlock(&mutex)); -} - -bool Mutex::trylock() { - return pthread_mutex_trylock(&mutex) == 0; -} - - -RWlock::RWlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_init(&rwlock, NULL)); -} - -RWlock::~RWlock(){ - QPID_POSIX_ABORT_IF(pthread_rwlock_destroy(&rwlock)); -} - -void RWlock::wlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_wrlock(&rwlock)); -} - -void RWlock::rlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_rdlock(&rwlock)); -} - -void RWlock::unlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_unlock(&rwlock)); -} - -void RWlock::trywlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_trywrlock(&rwlock)); -} - -void RWlock::tryrlock() { - QPID_POSIX_ASSERT_THROW_IF(pthread_rwlock_tryrdlock(&rwlock)); -} - - -}} -#endif /*!_sys_posix_Mutex_h*/ diff --git a/cpp/include/qpid/sys/posix/PrivatePosix.h b/cpp/include/qpid/sys/posix/PrivatePosix.h deleted file mode 100644 index 79cb950275..0000000000 --- a/cpp/include/qpid/sys/posix/PrivatePosix.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _sys_posix_PrivatePosix_h -#define _sys_posix_PrivatePosix_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/sys/Time.h" -#include "qpid/sys/IOHandle.h" - -struct timespec; -struct timeval; -struct addrinfo; - -namespace qpid { -namespace sys { - -// Private Time related implementation details -struct timespec& toTimespec(struct timespec& ts, const Duration& t); -struct timeval& toTimeval(struct timeval& tv, const Duration& t); -Duration toTime(const struct timespec& ts); - -// Private SocketAddress details -class SocketAddress; -const struct addrinfo& getAddrInfo(const SocketAddress&); - -// Private fd related implementation details -class IOHandlePrivate { -public: - IOHandlePrivate(int f = -1) : - fd(f) - {} - - int fd; -}; - -int toFd(const IOHandlePrivate* h); - -// Posix fd as an IOHandle -class PosixIOHandle : public IOHandle { -public: - PosixIOHandle(int fd) : - IOHandle(new IOHandlePrivate(fd)) - {} -}; - -// Dummy IOHandle for places it's required in the API -// but we promise not to actually try to do any operations on the IOHandle -class NullIOHandle : public IOHandle { -public: - NullIOHandle() : - IOHandle(new IOHandlePrivate) - {} -}; - -extern NullIOHandle DummyIOHandle; - -}} - -#endif /*!_sys_posix_PrivatePosix_h*/ diff --git a/cpp/include/qpid/sys/posix/Time.h b/cpp/include/qpid/sys/posix/Time.h deleted file mode 100755 index 62d734c816..0000000000 --- a/cpp/include/qpid/sys/posix/Time.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef QPID_SYS_POSIX_TIME_H -#define QPID_SYS_POSIX_TIME_H - -/* - * - * Copyright (c) 2006 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. - * 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 KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "qpid/sys/IntegerTypes.h" - -namespace qpid { -namespace sys { - -/** - * Class to represent an instant in time. - */ -typedef int64_t TimePrivate; - -}} // namespace qpid::sys - -#endif /*!QPID_SYS_POSIX_TIME_H*/ diff --git a/cpp/include/qpid/sys/posix/check.h b/cpp/include/qpid/sys/posix/check.h deleted file mode 100644 index 1bfe5d6d78..0000000000 --- a/cpp/include/qpid/sys/posix/check.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef _posix_check_h -#define _posix_check_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/Exception.h" -#include "qpid/Msg.h" - -#include <cerrno> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#define QPID_POSIX_ERROR(ERRNO) qpid::Exception(QPID_MSG(qpid::sys::strError(ERRNO))) - -/** THROW QPID_POSIX_ERROR(errno) if RESULT is less than zero */ -#define QPID_POSIX_CHECK(RESULT) \ - if ((RESULT) < 0) throw QPID_POSIX_ERROR((errno)) - -/** Throw a posix error if ERRNO is non-zero */ -#define QPID_POSIX_THROW_IF(ERRNO) \ - do { int e=(ERRNO); if (e) throw QPID_POSIX_ERROR(e); } while(0) - -/** Same as _THROW_IF in a release build, but abort a debug build */ -#ifdef NDEBUG -#define QPID_POSIX_ASSERT_THROW_IF(ERRNO) QPID_POSIX_THROW_IF(ERRNO) -#else -#define QPID_POSIX_ASSERT_THROW_IF(ERRNO) \ - do { int e=(ERRNO); if (e) { errno=e; ::perror(0); assert(0); } } while(0) -#endif - -#define QPID_POSIX_ABORT_IF(ERRNO) if ((int) ERRNO) { errno=ERRNO; ::perror(0); abort(); } - -#endif /*!_posix_check_h*/ diff --git a/cpp/include/qpid/sys/windows/Condition.h b/cpp/include/qpid/sys/windows/Condition.h deleted file mode 100755 index cd5aebbf09..0000000000 --- a/cpp/include/qpid/sys/windows/Condition.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _sys_windows_Condition_h -#define _sys_windows_Condition_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/sys/Mutex.h" -#include "qpid/sys/Time.h" - -#include <time.h> -#include <boost/noncopyable.hpp> -#include <boost/thread/condition.hpp> -#include <boost/thread/thread_time.hpp> -#include <windows.h> - -namespace qpid { -namespace sys { - -/** - * A condition variable for thread synchronization. - */ -class Condition : private boost::noncopyable -{ - public: - inline Condition(); - inline ~Condition(); - inline void wait(Mutex&); - inline bool wait(Mutex&, const AbsTime& absoluteTime); - inline void notify(); - inline void notifyAll(); - - private: - boost::condition_variable_any condition; -}; - -Condition::Condition() { -} - -Condition::~Condition() { -} - -void Condition::wait(Mutex& mutex) { - condition.wait(mutex.mutex); -} - -bool Condition::wait(Mutex& mutex, const AbsTime& absoluteTime){ - return condition.timed_wait(mutex.mutex, absoluteTime.timepoint); -} - -void Condition::notify(){ - condition.notify_one(); -} - -void Condition::notifyAll(){ - condition.notify_all(); -} - -}} -#endif /*!_sys_windows_Condition_h*/ diff --git a/cpp/include/qpid/sys/windows/IntegerTypes.h b/cpp/include/qpid/sys/windows/IntegerTypes.h deleted file mode 100755 index fff320bc96..0000000000 --- a/cpp/include/qpid/sys/windows/IntegerTypes.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef QPID_SYS_WINDOWS_INTEGERTYPES_H -#define QPID_SYS_WINDOWS_INTEGERTYPES_H - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef short int16_t; -typedef unsigned int uint32_t; -typedef int int32_t; -#if defined(_MSC_VER) -typedef 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; - -#endif /*!QPID_SYS_WINDOWS_INTEGERTYPES_H*/ diff --git a/cpp/include/qpid/sys/windows/Mutex.h b/cpp/include/qpid/sys/windows/Mutex.h deleted file mode 100755 index 5dcc69e836..0000000000 --- a/cpp/include/qpid/sys/windows/Mutex.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef _sys_windows_Mutex_h -#define _sys_windows_Mutex_h - -/* - * - * Copyright (c) 2008 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. - * 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 KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "qpid/sys/windows/check.h" - -#include <boost/version.hpp> -#if (BOOST_VERSION < 103500) -#error The Windows port requires Boost version 1.35.0 or later -#endif - -#include <boost/noncopyable.hpp> -#include <boost/thread/recursive_mutex.hpp> -#include <boost/thread/shared_mutex.hpp> -#include <boost/thread/thread_time.hpp> -#include <boost/thread/tss.hpp> - -namespace qpid { -namespace sys { - -class Condition; - -/** - * Mutex lock. - */ -class Mutex : private boost::noncopyable { - friend class Condition; - -public: - typedef ::qpid::sys::ScopedLock<Mutex> ScopedLock; - typedef ::qpid::sys::ScopedUnlock<Mutex> ScopedUnlock; - - inline Mutex(); - inline ~Mutex(); - inline void lock(); - inline void unlock(); - inline bool trylock(); - - -protected: - boost::recursive_mutex mutex; -}; - -/** - * RW lock. - */ -class RWlock : private boost::noncopyable { - friend class Condition; - -public: - typedef ::qpid::sys::ScopedRlock<RWlock> ScopedRlock; - typedef ::qpid::sys::ScopedWlock<RWlock> ScopedWlock; - - inline RWlock(); - inline ~RWlock(); - inline void wlock(); // will write-lock - inline void rlock(); // will read-lock - inline void unlock(); - inline void trywlock(); // will write-try - inline void tryrlock(); // will read-try - -protected: - boost::shared_mutex rwMutex; - boost::thread_specific_ptr<bool> haveWrite; - - inline bool &write (void); -}; - - -/** - * PODMutex is a POD, can be static-initialized with - * PODMutex m = QPID_PODMUTEX_INITIALIZER - */ -struct PODMutex -{ - typedef ::qpid::sys::ScopedLock<PODMutex> ScopedLock; - - inline void lock(); - inline void unlock(); - inline bool trylock(); - - // Must be public to be a POD: - boost::recursive_mutex mutex; -}; - -#define QPID_MUTEX_INITIALIZER 0 - -void PODMutex::lock() { - mutex.lock(); -} - -void PODMutex::unlock() { - mutex.unlock(); -} - -bool PODMutex::trylock() { - return mutex.try_lock(); -} - -Mutex::Mutex() { -} - -Mutex::~Mutex(){ -} - -void Mutex::lock() { - mutex.lock(); -} - -void Mutex::unlock() { - mutex.unlock(); -} - -bool Mutex::trylock() { - return mutex.try_lock(); -} - - -RWlock::RWlock() { -} - -RWlock::~RWlock(){ -} - -void RWlock::wlock() { - bool &writer = write(); - rwMutex.lock(); - writer = true; // Remember this thread has write lock held. -} - -void RWlock::rlock() { - bool &writer = write(); - rwMutex.lock_shared(); - writer = false; // Remember this thread has shared lock held. -} - -void RWlock::unlock() { - bool &writer = write(); - if (writer) - rwMutex.unlock(); - else - rwMutex.unlock_shared(); -} - -void RWlock::trywlock() { - bool &writer = write(); - // shared_mutex::try_lock() seems to not be available... emulate it with - // a timed lock(). - boost::system_time now = boost::get_system_time(); - if (rwMutex.timed_lock(now)) - writer = true; -} - -void RWlock::tryrlock() { - bool &writer = write(); - if (rwMutex.try_lock_shared()) - writer = false; -} - -bool & RWlock::write (void) { - // Accessing thread-specific and stack-local info, so no locks needed. - bool *writePtr = haveWrite.get(); - if (writePtr == 0) { - writePtr = new bool(false); - haveWrite.reset(writePtr); - } - return *writePtr; -} - -}} -#endif /*!_sys_windows_Mutex_h*/ diff --git a/cpp/include/qpid/sys/windows/Time.h b/cpp/include/qpid/sys/windows/Time.h deleted file mode 100644 index 2987b1c8b2..0000000000 --- a/cpp/include/qpid/sys/windows/Time.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef QPID_SYS_WINDOWS_TIME_H -#define QPID_SYS_WINDOWS_TIME_H - -/* - * - * Copyright (c) 2006 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. - * 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 KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include <boost/date_time/posix_time/posix_time_types.hpp> - -namespace qpid { -namespace sys { - -/** - * Class to represent an instant in time. Boost has this stuff already done - * so just reuse it. We can also grab this for quick use with the Condition - * wait operations. - */ -typedef boost::posix_time::ptime TimePrivate; - -}} // namespace qpid::sys - -#endif /*!QPID_SYS_WINDOWS_TIME_H*/ diff --git a/cpp/include/qpid/sys/windows/check.h b/cpp/include/qpid/sys/windows/check.h deleted file mode 100755 index 2a8e439bed..0000000000 --- a/cpp/include/qpid/sys/windows/check.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _windows_check_h -#define _windows_check_h - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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 - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/Exception.h" -#include "qpid/Msg.h" -#include "qpid/sys/StrError.h" - -#define QPID_WINDOWS_ERROR(ERRVAL) qpid::Exception(QPID_MSG(qpid::sys::strError(ERRVAL))) -#define QPID_WINDOWS_CRT_ERROR(ERRNO) qpid::Exception(QPID_MSG(qpid::sys::strError(ERRNO))) - -/** THROW QPID_WINDOWS_ERROR(::GetLastError()) if RESULT is NULL */ -#define QPID_WINDOWS_CHECK_NULL(RESULT) \ - if ((RESULT) == NULL) throw QPID_WINDOWS_ERROR((::GetLastError())) - -#define QPID_WINDOWS_CHECK_NOT(RESULT,VAL) \ - if ((RESULT) == (VAL)) throw QPID_WINDOWS_ERROR((::GetLastError())) - -#define QPID_WINDOWS_CHECK_ASYNC_START(STATUS) \ - if (!(STATUS) && ::WSAGetLastError() != ERROR_IO_PENDING) \ - throw QPID_WINDOWS_ERROR((::WSAGetLastError())) - -#define QPID_WINDOWS_CHECK_CRT_NZ(VAL) \ - if ((VAL) == 0) throw QPID_WINDOWS_CRT_ERROR(errno) - -#define QPID_WINSOCK_CHECK(OP) \ - if ((OP) == SOCKET_ERROR) throw QPID_WINDOWS_ERROR((::WSAGetLastError())) - -#endif /*!_windows_check_h*/ |