Boost logo

Boost-Commit :

From: xushiweizh_at_[hidden]
Date: 2008-05-06 05:09:54


Author: xushiwei
Date: 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
New Revision: 45165
URL: http://svn.boost.org/trac/boost/changeset/45165

Log:
1. move threadmodel, winapi to boost::detail
2. add log, debug, performance_counter to boost::detail
Added:
   sandbox/memory/boost/detail/
   sandbox/memory/boost/detail/debug.hpp (contents, props changed)
   sandbox/memory/boost/detail/log.hpp (contents, props changed)
   sandbox/memory/boost/detail/performance_counter.hpp (contents, props changed)
   sandbox/memory/boost/detail/threadmodel/
   sandbox/memory/boost/detail/threadmodel.hpp (contents, props changed)
   sandbox/memory/boost/detail/threadmodel/multi_thread.hpp (contents, props changed)
   sandbox/memory/boost/detail/threadmodel/single_thread.hpp (contents, props changed)
   sandbox/memory/boost/detail/winapi/
   sandbox/memory/boost/detail/winapi/atomic/
   sandbox/memory/boost/detail/winapi/atomic/atomic_builtins.hpp (contents, props changed)
   sandbox/memory/boost/detail/winapi/atomic/solaris.hpp (contents, props changed)
   sandbox/memory/boost/detail/winapi/atomic/windows.hpp (contents, props changed)
   sandbox/memory/boost/detail/winapi/posix/
   sandbox/memory/boost/detail/winapi/posix/pthread.hpp (contents, props changed)
   sandbox/memory/boost/detail/winapi/posix/time.hpp (contents, props changed)
   sandbox/memory/boost/detail/winapi/winbase.h (contents, props changed)
   sandbox/memory/boost/detail/winapi/windef.h (contents, props changed)
   sandbox/memory/boost/detail/winapi/wtypes.h (contents, props changed)
   sandbox/memory/libs/memory/test/test_basic/memory/performance.cpp (contents, props changed)
Removed:
   sandbox/memory/boost/memory/threadmodel/
   sandbox/memory/boost/memory/threadmodel.hpp
   sandbox/memory/boost/memory/winapi/
Text files modified:
   sandbox/memory/boost/memory/basic.hpp | 40 ++++++++++------------------------------
   sandbox/memory/boost/memory/policy.hpp | 2 +-
   sandbox/memory/boost/memory/system_alloc.hpp | 4 ++--
   sandbox/memory/boost/memory/thread/tls.hpp | 6 +++---
   sandbox/memory/libs/memory/test/test_basic/test.dsp | 4 ++++
   5 files changed, 20 insertions(+), 36 deletions(-)

Added: sandbox/memory/boost/detail/debug.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/debug.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,40 @@
+//
+// boost/detail/debug.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_DEBUG_HPP
+#define BOOST_DETAIL_DEBUG_HPP
+
+// -------------------------------------------------------------------------
+// BOOST_DETAIL_ASSERT - diagnost
+
+#ifndef BOOST_DETAIL_ASSERT
+ #if defined(ASSERT)
+ #define BOOST_DETAIL_ASSERT(e) ASSERT(e)
+ #elif defined(_ASSERTE)
+ #define BOOST_DETAIL_ASSERT(e) _ASSERTE(e)
+ #elif defined(BOOST_ASSERT)
+ #define BOOST_DETAIL_ASSERT(e) BOOST_ASSERT(e)
+ #else
+ #ifdef _DEBUG
+ #ifndef assert
+ #include <cassert>
+ #endif
+ #define BOOST_DETAIL_ASSERT(e) assert(e)
+ #else
+ #define BOOST_DETAIL_ASSERT(e)
+ #endif
+ #endif
+#endif
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_DEBUG_HPP */

Added: sandbox/memory/boost/detail/log.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/log.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,86 @@
+//
+// boost/detail/log.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_LOG_HPP
+#define BOOST_DETAIL_LOG_HPP
+
+#if !defined(_INC_STDIO) && !defined(_STDIO_H)
+#include <stdio.h> // vprintf, vfprintf
+#endif
+
+#if !defined(_INC_STDARG) && !defined(_STDARG_H)
+#include <stdarg.h> // va_list
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef NS_BOOST_DETAIL_BEGIN
+#define NS_BOOST_DETAIL_BEGIN namespace boost { namespace detail {
+#define NS_BOOST_DETAIL_END } }
+#define NS_BOOST_DETAIL boost::detail
+#endif
+
+#ifndef BOOST_DETAIL_CALL
+#define BOOST_DETAIL_CALL
+#endif
+
+NS_BOOST_DETAIL_BEGIN
+
+// -------------------------------------------------------------------------
+// class null_log
+
+class null_log
+{
+public:
+ null_log& BOOST_DETAIL_CALL trace(const char* fmt, ...)
+ {
+ return *this;
+ }
+};
+
+// -------------------------------------------------------------------------
+// class stdout_log
+
+class stdout_log
+{
+public:
+ stdout_log& BOOST_DETAIL_CALL trace(const char* fmt, ...)
+ {
+ va_list args;
+ va_start(args, fmt);
+ vprintf(fmt, args);
+ va_end(args);
+ return *this;
+ }
+};
+
+// -------------------------------------------------------------------------
+// class stderr_log
+
+class stderr_log
+{
+public:
+ stderr_log& BOOST_DETAIL_CALL trace(const char* fmt, ...)
+ {
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ return *this;
+ }
+};
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+NS_BOOST_DETAIL_END
+
+#endif /* BOOST_DETAIL_LOG_HPP */

Added: sandbox/memory/boost/detail/performance_counter.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/performance_counter.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,171 @@
+//
+// boost/detail/performance_counter.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_PERFORMANCE_COUNTER_HPP
+#define BOOST_DETAIL_PERFORMANCE_COUNTER_HPP
+
+#ifndef BOOST_DETAIL_LOG_HPP
+#include "log.hpp"
+#endif
+
+#ifndef BOOST_DETAIL_DEBUG_HPP
+#include "debug.hpp"
+#endif
+
+NS_BOOST_DETAIL_BEGIN
+
+// -------------------------------------------------------------------------
+
+template <class UIntT, class CharT>
+inline CharT* BOOST_DETAIL_CALL _ui2estr(const UIntT& val, CharT* estr)
+{
+ *estr-- = '\0';
+ do {
+ *estr-- = '0' + val % 10;
+ val /= 10;
+ }
+ while (val);
+ return estr;
+}
+
+// -------------------------------------------------------------------------
+// class performance_counter
+
+class performance_counter
+{
+public:
+ typedef UINT64 value_type;
+
+private:
+ value_type m_tick;
+
+private:
+ static value_type BOOST_DETAIL_CALL _get_freq()
+ {
+ value_type _freq = 0;
+ QueryPerformanceFrequency(&(LARGE_INTEGER&)_freq);
+ if (_freq == 0)
+ {
+ BOOST_DETAIL_ASSERT(!"QueryPerformanceFrequency is unsupported\n");
+ _freq = 1;
+ }
+ return _freq;
+ }
+
+public:
+ performance_counter()
+ {
+ freq();
+ start();
+ }
+
+ static value_type BOOST_DETAIL_CALL freq()
+ {
+ static value_type s_freq = _get_freq();
+ return s_freq;
+ }
+
+ void BOOST_DETAIL_CALL start()
+ {
+ QueryPerformanceCounter(&(LARGE_INTEGER&)m_tick);
+ }
+
+ __forceinline value_type BOOST_DETAIL_CALL duration() const
+ {
+ value_type tickNow;
+ QueryPerformanceCounter(&(LARGE_INTEGER&)tickNow);
+ return tickNow - m_tick;
+ }
+
+public:
+ template <class LogT>
+ static void BOOST_DETAIL_CALL trace(LogT& log, const value_type& ticks)
+ {
+ double msVal = (INT64)ticks * 1000.0 / (INT64)freq();
+ char szTicks[32];
+ log.trace(
+ "---> Elapse %s ticks (%.2lf ms) (%.2lf min) ...\n",
+ _ui2estr(ticks, szTicks + sizeof(szTicks)), msVal, msVal/60000.0
+ );
+ }
+
+ template <class LogT>
+ value_type BOOST_DETAIL_CALL trace(LogT& log)
+ {
+ value_type dur = duration();
+ trace(log, dur);
+ return dur;
+ }
+};
+
+// -------------------------------------------------------------------------
+// class accumulator
+
+template <class CounterT = performance_counter>
+class accumulator_imp
+{
+public:
+ typedef typename CounterT::value_type value_type;
+ typedef size_t size_type;
+
+private:
+ value_type m_acc;
+ size_type m_count;
+
+public:
+ accumulator_imp() {
+ m_acc = 0;
+ m_count = 0;
+ }
+
+ void BOOST_DETAIL_CALL start() {
+ m_acc = 0;
+ m_count = 0;
+ }
+
+ size_type BOOST_DETAIL_CALL count() const {
+ return m_count;
+ }
+
+ const value_type& BOOST_DETAIL_CALL accumulate() const {
+ return m_acc;
+ }
+
+ void BOOST_DETAIL_CALL accumulate(const value_type& val) {
+ m_acc += val;
+ ++m_count;
+ }
+
+ __forceinline void BOOST_DETAIL_CALL accumulate(const CounterT& counter) {
+ m_acc += counter.duration();
+ ++m_count;
+ }
+
+ template <class LogT>
+ void BOOST_DETAIL_CALL trace_avg(LogT& log) {
+ log.trace("Average: ");
+ CounterT::trace(log, m_acc/m_count);
+ }
+
+ template <class LogT>
+ void BOOST_DETAIL_CALL trace(LogT& log) {
+ CounterT::trace(log, m_acc);
+ }
+};
+
+typedef accumulator_imp<> accumulator;
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+NS_BOOST_DETAIL_END
+
+#endif /* BOOST_DETAIL_PERFORMANCE_COUNTER_HPP */

Added: sandbox/memory/boost/detail/threadmodel.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/threadmodel.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,81 @@
+//
+// boost/detail/threadmodel.hpp (*)
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_THREADMODEL_HPP
+#define BOOST_DETAIL_THREADMODEL_HPP
+
+#ifndef NS_BOOST_DETAIL_BEGIN
+#define NS_BOOST_DETAIL_BEGIN namespace boost { namespace detail {
+#define NS_BOOST_DETAIL_END } }
+#define NS_BOOST_DETAIL boost::detail
+#endif
+
+#ifndef BOOST_DETAIL_CALL
+#define BOOST_DETAIL_CALL
+#endif
+
+// -------------------------------------------------------------------------
+
+#include "winapi/winbase.h"
+
+#ifndef BOOST_DETAIL_THREADMODEL_SINGLE_THREAD_HPP
+#include "threadmodel/single_thread.hpp"
+#endif
+
+#ifndef BOOST_DETAIL_THREADMODEL_MULTI_THREAD_HPP
+#include "threadmodel/multi_thread.hpp"
+#endif
+
+NS_BOOST_DETAIL_BEGIN
+
+// -------------------------------------------------------------------------
+// class multi_thread
+
+class multi_thread
+{
+public:
+ typedef refcount_mt refcount;
+ typedef critical_section_mt critical_section;
+
+public:
+ typedef critical_section cs;
+ typedef cs::scoped_lock cslock;
+};
+
+// -------------------------------------------------------------------------
+// class single_thread
+
+class single_thread
+{
+public:
+ typedef refcount_st refcount;
+ typedef critical_section_st critical_section;
+
+public:
+ typedef critical_section cs;
+ typedef cs::scoped_lock cslock;
+};
+
+// -------------------------------------------------------------------------
+// class default_threadmodel
+
+#if defined(_MT)
+typedef multi_thread default_threadmodel;
+#else
+typedef single_thread default_threadmodel;
+#endif
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+NS_BOOST_DETAIL_END
+
+#endif /* BOOST_DETAIL_THREADMODEL_HPP */

Added: sandbox/memory/boost/detail/threadmodel/multi_thread.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/threadmodel/multi_thread.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,128 @@
+//
+// boost/detail/threadmodel/multi_thread.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_THREADMODEL_MULTI_THREAD_HPP
+#define BOOST_DETAIL_THREADMODEL_MULTI_THREAD_HPP
+
+NS_BOOST_DETAIL_BEGIN
+
+// -------------------------------------------------------------------------
+// class scoped_lock
+
+template <class LockT>
+class scoped_lock
+{
+private:
+ LockT& m_lock;
+
+private:
+ scoped_lock(const scoped_lock&);
+ void operator=(const scoped_lock&);
+
+public:
+ scoped_lock(LockT& lock) : m_lock(lock)
+ {
+ m_lock.acquire();
+ }
+ ~scoped_lock()
+ {
+ m_lock.release();
+ }
+};
+
+// -------------------------------------------------------------------------
+// class refcount_mt
+
+class refcount_mt
+{
+public:
+ typedef LONG value_type;
+
+private:
+ value_type m_nRef;
+
+public:
+ refcount_mt(value_type nRef)
+ : m_nRef(nRef)
+ {
+ }
+
+ value_type BOOST_DETAIL_CALL acquire()
+ {
+ return InterlockedIncrement(&m_nRef);
+ }
+
+ value_type BOOST_DETAIL_CALL release()
+ {
+ return InterlockedDecrement(&m_nRef);
+ }
+
+ operator value_type()
+ {
+ return m_nRef;
+ }
+};
+
+// -------------------------------------------------------------------------
+// class critical_section_mt
+
+class critical_section_mt
+{
+private:
+ CRITICAL_SECTION m_cs;
+
+private:
+ critical_section_mt(const critical_section_mt&);
+ void operator=(const critical_section_mt&);
+
+public:
+ critical_section_mt()
+ {
+ InitializeCriticalSection(&m_cs);
+ }
+ ~critical_section_mt()
+ {
+ DeleteCriticalSection(&m_cs);
+ }
+
+ void BOOST_DETAIL_CALL acquire()
+ {
+ EnterCriticalSection(&m_cs);
+ }
+
+ void BOOST_DETAIL_CALL release()
+ {
+ LeaveCriticalSection(&m_cs);
+ }
+
+#if defined(_DEBUG)
+ bool BOOST_DETAIL_CALL good() const // debug only
+ {
+ const char* p = (const char*)&m_cs;
+ for (size_t i = 0; i < sizeof(m_cs); ++i)
+ {
+ if (p[i] != 0)
+ return true;
+ }
+ return false;
+ }
+#endif
+
+public:
+ typedef NS_BOOST_DETAIL::scoped_lock<critical_section_mt> scoped_lock;
+};
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+NS_BOOST_DETAIL_END
+
+#endif /* BOOST_DETAIL_THREADMODEL_MULTI_THREAD_HPP */

Added: sandbox/memory/boost/detail/threadmodel/single_thread.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/threadmodel/single_thread.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,66 @@
+//
+// boost/detail/threadmodel/single_thread.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_THREADMODEL_SINGLE_THREAD_HPP
+#define BOOST_DETAIL_THREADMODEL_SINGLE_THREAD_HPP
+
+NS_BOOST_DETAIL_BEGIN
+
+// -------------------------------------------------------------------------
+// struct refcount_st
+
+class refcount_st
+{
+public:
+ typedef long value_type;
+
+private:
+ value_type m_nRef;
+
+public:
+ refcount_st(value_type nRef) : m_nRef(nRef)
+ {
+ }
+
+ value_type BOOST_DETAIL_CALL acquire() { return ++m_nRef; }
+ value_type BOOST_DETAIL_CALL release() { return --m_nRef; }
+
+ operator value_type()
+ {
+ return m_nRef;
+ }
+};
+
+// -------------------------------------------------------------------------
+// class critical_section_st
+
+class critical_section_st
+{
+public:
+ void BOOST_DETAIL_CALL acquire() {}
+ void BOOST_DETAIL_CALL release() {}
+
+#if defined(_DEBUG)
+ bool BOOST_DETAIL_CALL good() const {
+ return true;
+ }
+#endif
+
+public:
+ class scoped_lock {};
+};
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+NS_BOOST_DETAIL_END
+
+#endif /* BOOST_DETAIL_THREADMODEL_SINGLE_THREAD_HPP */

Added: sandbox/memory/boost/detail/winapi/atomic/atomic_builtins.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/atomic/atomic_builtins.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,65 @@
+//
+// boost/detail/winapi/atomic/atomic_builtins.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_ATOMIC_ATOMIC_BUILTINS_HPP
+#define BOOST_DETAIL_WINAPI_ATOMIC_ATOMIC_BUILTINS_HPP
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedIncrement(volatile LPLONG lpAddend)
+{
+ return __sync_add_and_fetch(lpAddend, 1);
+}
+
+__forceinline LONG WINAPI InterlockedDecrement(volatile LPLONG lpAddend)
+{
+ return __sync_sub_and_fetch(lpAddend, 1);
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedExchange(volatile LPLONG Target, LONG Value)
+{
+ __sync_synchronize();
+ return __sync_lock_test_and_set(Target, Value);
+}
+
+__forceinline PVOID WINAPI InterlockedExchangePointer(volatile PVOID* Target, PVOID Value)
+{
+ __sync_synchronize();
+ return (PVOID)__sync_lock_test_and_set(Target, Value);
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedExchangeAdd(volatile LPLONG Addend, LONG Value)
+{
+ return __sync_fetch_and_add(Addend, Value);
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedCompareExchange(
+ volatile LPLONG Destination, LONG Exchange, LONG Comperand)
+{
+ return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
+}
+
+__forceinline PVOID WINAPI InterlockedCompareExchangePointer(
+ volatile PVOID* Destination, PVOID Exchange, PVOID Comperand)
+{
+ return (PVOID)__sync_val_compare_and_swap(Destination, Comperand, Exchange);
+}
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_ATOMIC_ATOMIC_BUILTINS_HPP */

Added: sandbox/memory/boost/detail/winapi/atomic/solaris.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/atomic/solaris.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,63 @@
+//
+// boost/detail/winapi/atomic/solaris.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_ATOMIC_SOLARIS_HPP
+#define BOOST_DETAIL_WINAPI_ATOMIC_SOLARIS_HPP
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedIncrement(volatile LPLONG lpAddend)
+{
+ return atomic_inc_32_nv(lpAddend);
+}
+
+__forceinline LONG WINAPI InterlockedDecrement(volatile LPLONG lpAddend)
+{
+ return atomic_dec_32_nv(lpAddend);
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedExchange(volatile LPLONG Target, LONG Value)
+{
+ return atomic_swap_32(Target, Value);
+}
+
+__forceinline PVOID WINAPI InterlockedExchangePointer(volatile PVOID* Target, PVOID Value)
+{
+ return atomic_swap_ptr(Target, Value);
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedExchangeAdd(volatile LPLONG Addend, LONG Value)
+{
+ return atomic_add_32_nv(Addend, Value) - Value;
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline LONG WINAPI InterlockedCompareExchange(
+ volatile LPLONG Destination, LONG Exchange, LONG Comperand)
+{
+ return atomic_cas_32(Destination, Comperand, Exchange);
+}
+
+__forceinline PVOID WINAPI InterlockedCompareExchangePointer(
+ volatile PVOID* Destination, PVOID Exchange, PVOID Comperand)
+{
+ return atomic_cas_ptr(Destination, Comperand, Exchange);
+}
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_ATOMIC_SOLARIS_HPP */

Added: sandbox/memory/boost/detail/winapi/atomic/windows.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/atomic/windows.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,66 @@
+//
+// boost/detail/winapi/atomic/windows.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_ATOMIC_WINDOWS_HPP
+#define BOOST_DETAIL_WINAPI_ATOMIC_WINDOWS_HPP
+
+// -------------------------------------------------------------------------
+
+// we use our own implementation of InterlockedExchangePointer because of problems with the one in system headers
+__forceinline PVOID WINAPI boost_InterlockedExchangePointer(PVOID* Target, PVOID Value)
+{
+ return reinterpret_cast<PVOID>(static_cast<LONG_PTR>(
+ InterlockedExchange(
+ reinterpret_cast<LONG*>(Target),
+ static_cast<LONG>(reinterpret_cast<LONG_PTR>(Value))
+ )
+ ));
+}
+
+#undef InterlockedExchangePointer
+#define InterlockedExchangePointer boost_InterlockedExchangePointer
+
+// -------------------------------------------------------------------------
+
+#if defined(BOOST_DETAIL_WINSDK_VC6)
+
+__forceinline PVOID WINAPI boost_InterlockedCompareExchange(
+ LPLONG Destination, LONG Exchange, LONG Comperand)
+{
+ return InterlockedCompareExchange(
+ (PVOID*)Destination, (PVOID)Exchange, (PVOID)Comperand);
+}
+
+#define InterlockedCompareExchange boost_InterlockedCompareExchange
+#define InterlockedCompareExchangePointer InterlockedCompareExchange
+
+#elif !defined(InterlockedCompareExchangePointer)
+
+__forceinline PVOID WINAPI boost_InterlockedCompareExchangePointer(
+ PVOID* Destination, PVOID Exchange, PVOID Comperand)
+{
+ return reinterpret_cast<PVOID>(static_cast<LONG_PTR>(
+ InterlockedCompareExchange(
+ reinterpret_cast<LONG*>(Destination),
+ static_cast<LONG>(reinterpret_cast<LONG_PTR>(Exchange)),
+ static_cast<LONG>(reinterpret_cast<LONG_PTR>(Comperand))
+ )
+ ));
+}
+
+#define InterlockedCompareExchangePointer boost_InterlockedCompareExchangePointer
+
+#endif
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_ATOMIC_WINDOWS_HPP */

Added: sandbox/memory/boost/detail/winapi/posix/pthread.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/posix/pthread.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,111 @@
+//
+// boost/detail/winapi/posix/pthread.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_POSIX_PTHREAD_HPP
+#define BOOST_DETAIL_WINAPI_POSIX_PTHREAD_HPP
+
+#ifndef BOOST_DETAIL_WINAPI_WINDEF_H
+#include "../windef.h"
+#endif
+
+#ifndef _PTHREAD_H
+#include <pthread.h>
+#endif
+
+// -------------------------------------------------------------------------
+// CriticalSection
+
+typedef pthread_mutex_t RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
+typedef RTL_CRITICAL_SECTION CRITICAL_SECTION;
+typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION;
+typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION;
+
+__forceinline VOID WINAPI InitializeCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_init(lpCriticalSection, NULL);
+}
+
+__forceinline VOID WINAPI EnterCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_lock(lpCriticalSection);
+}
+
+__forceinline BOOL WINAPI TryEnterCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ return pthread_mutex_trylock(lpCriticalSection) == 0;
+}
+
+__forceinline VOID WINAPI LeaveCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_unlock(lpCriticalSection);
+}
+
+__forceinline VOID WINAPI DeleteCriticalSection(
+ LPCRITICAL_SECTION lpCriticalSection)
+{
+ pthread_mutex_destroy(lpCriticalSection);
+}
+
+// -------------------------------------------------------------------------
+
+__forceinline DWORD WINAPI GetCurrentThreadId()
+{
+#if defined(PTW32_VERSION)
+ return (DWORD)pthread_self().p;
+#else
+ return pthread_self();
+#endif
+}
+
+// -------------------------------------------------------------------------
+
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF
+#endif
+
+#ifndef S_OK
+#define S_OK 0
+#endif
+
+typedef pthread_key_t TLSINDEX;
+
+__forceinline TLSINDEX WINAPI TlsAlloc(void)
+{
+ pthread_key_t key;
+ if (pthread_key_create(&key, NULL) != S_OK)
+ return TLS_OUT_OF_INDEXES;
+ else
+ return key;
+}
+
+__forceinline BOOL WINAPI TlsFree(TLSINDEX key)
+{
+ return pthread_key_delete(key) == S_OK;
+}
+
+__forceinline BOOL WINAPI TlsSetValue(TLSINDEX key, LPVOID lpTlsValue)
+{
+ return pthread_setspecific(key, lpTlsValue) == S_OK;
+}
+
+__forceinline LPVOID WINAPI TlsGetValue(TLSINDEX key)
+{
+ return pthread_getspecific(key);
+}
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_POSIX_PTHREAD_HPP */

Added: sandbox/memory/boost/detail/winapi/posix/time.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/posix/time.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,65 @@
+//
+// boost/detail/winapi/posix/time.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_POSIX_TIME_HPP
+#define BOOST_DETAIL_WINAPI_POSIX_TIME_HPP
+
+#ifndef BOOST_DETAIL_WINAPI_WINDEF_H
+#include "../windef.h"
+#endif
+
+// -------------------------------------------------------------------------
+// int clock_getres(clockid_t clk_id, struct timespec *res);
+// int clock_gettime(clockid_t clk_id, struct timespec *tp);
+// int clock_settime(clockid_t clk_id, const struct timespec *tp);
+
+#ifndef _TIME_H
+#include <time.h>
+#endif
+
+#ifndef _UNISTD_H
+#include <unistd.h>
+#endif
+
+// See http://linux.die.net/man/3/clock_gettime
+// On POSIX systems on which these functions are available, the symbol _POSIX_TIMERS
+// is defined in <unistd.h> to a value greater than 0.
+// The symbols _POSIX_MONOTONIC_CLOCK, _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME indicate
+// that CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID are available.
+#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && defined(_POSIX_MONOTONIC_CLOCK)
+#define BOOST_DETAIL_HAS_MONOTONIC_CLOCK
+#endif
+
+// -------------------------------------------------------------------------
+
+#if defined(BOOST_DETAIL_HAS_MONOTONIC_CLOCK)
+
+__forceinline BOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER* lp)
+{
+ lp->QuadPart = 1000000000;
+ return TRUE;
+}
+
+__forceinline BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER* lp)
+{
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ UINT64 ticks = (UINT64)now.tv_sec * 1000000000 + now.tv_nsec;
+ lp->QuadPart = ticks;
+ return TRUE;
+}
+
+#endif
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_POSIX_TIME_HPP */

Added: sandbox/memory/boost/detail/winapi/winbase.h
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/winbase.h 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,77 @@
+//
+// boost/detail/winapi/winbase.h
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_WINBASE_H
+#define BOOST_DETAIL_WINAPI_WINBASE_H
+
+#if defined(_WIN32)
+
+#ifndef __wtypes_h__
+#include <wtypes.h>
+#endif
+
+#ifndef _WINBASE_
+#include <winbase.h>
+#endif
+
+#ifndef _BASETSD_H_
+#include <basetsd.h>
+#endif
+
+#if !defined(_W64)
+ #define BOOST_DETAIL_WINSDK_VC6
+ #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+ #define _W64 __w64
+ #else
+ #define _W64
+ #endif
+#endif
+
+#if defined(BOOST_DETAIL_WINSDK_VC6)
+ #if defined(_WIN64)
+ typedef __int64 LONG_PTR, *PLONG_PTR;
+ typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
+ #else
+ typedef _W64 long LONG_PTR, *PLONG_PTR;
+ typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR;
+ #endif
+#endif
+
+#ifndef BOOST_DETAIL_WINAPI_ATOMIC_WINDOWS_HPP
+#include "atomic/windows.hpp"
+#endif
+
+#else
+
+#define BOOST_DETAIL_NO_WINSDK
+
+#ifndef BOOST_DETAIL_WINAPI_WTYPES_H
+#include "wtypes.h"
+#endif
+
+#ifndef BOOST_DETAIL_WINAPI_POSIX_PTHREAD_HPP
+#include "posix/pthread.hpp"
+#endif
+
+#ifndef BOOST_DETAIL_WINAPI_POSIX_TIME_HPP
+#include "posix/time.hpp"
+#endif
+
+#ifndef BOOST_DETAIL_WINAPI_ATOMIC_ATOMIC_BUILTINS_HPP
+#include "atomic/atomic_builtins.hpp"
+#endif
+
+#endif
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_WINBASE_H */

Added: sandbox/memory/boost/detail/winapi/windef.h
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/windef.h 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,568 @@
+//
+// boost/detail/winapi/windef.h
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_WINDEF_H
+#define BOOST_DETAIL_WINAPI_WINDEF_H
+
+#ifndef BOOST_DETAIL_NO_WINSDK
+#error "Don't include <winapi/windef.h>"
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifdef __cplusplus
+ #define EXTERN_C extern "C"
+#else
+ #define EXTERN_C extern
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef CDECL
+#define CDECL
+#endif
+
+#if defined(__GNUG__)
+#define __forceinline inline
+#define __stdcall
+#endif
+
+#ifdef _MAC
+#define CALLBACK PASCAL
+#define WINAPI CDECL
+#define WINAPIV CDECL
+#define APIENTRY WINAPI
+#define APIPRIVATE CDECL
+#ifdef _68K_
+#define PASCAL __pascal
+#else
+#define PASCAL
+#endif
+#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
+#define CALLBACK __stdcall
+#define WINAPI __stdcall
+#define WINAPIV __cdecl
+#define APIENTRY WINAPI
+#define APIPRIVATE __stdcall
+#define PASCAL __stdcall
+#else
+#define CALLBACK
+#define WINAPI
+#define WINAPIV
+#define APIENTRY WINAPI
+#define APIPRIVATE
+#define PASCAL pascal
+#endif
+
+#ifndef STDAPICALLTYPE
+#define STDAPICALLTYPE __stdcall
+#endif
+
+#ifndef STDMETHODCALLTYPE
+#define STDMETHODCALLTYPE __stdcall
+#endif
+
+#ifndef STDMETHODIMP
+#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
+#define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
+#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
+#define STDMETHODIMP_(type) type STDMETHODCALLTYPE
+#endif
+
+#ifndef STDAPI
+#define STDAPI EXTERN_C HRESULT STDMETHODCALLTYPE
+#define STDAPI_(type) EXTERN_C type STDMETHODCALLTYPE
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef __RPC_FAR
+#define __RPC_FAR
+#endif
+
+typedef void __RPC_FAR * RPC_IF_HANDLE;
+
+#ifndef MIDL_INTERFACE
+#define MIDL_INTERFACE(x) struct
+#endif
+
+#ifndef MIDL_INTERFACE_
+#define MIDL_INTERFACE_(x, Intrf) struct Intrf
+#endif
+
+#ifndef PURE
+#define PURE = 0
+#endif
+
+#ifndef interface
+#define interface struct
+#endif
+
+// -------------------------------------------------------------------------
+
+#ifndef NULL
+ #ifdef __cplusplus
+ #define NULL 0
+ #else
+ #define NULL ((void *)0)
+ #endif
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+#ifndef OPTIONAL
+#define OPTIONAL
+#endif
+
+#ifndef CONST
+#define CONST const
+#endif
+
+#undef far
+#undef near
+#define far
+#define near
+
+#undef FAR
+#undef NEAR
+#define FAR far
+#define NEAR near
+
+#ifndef VOID
+#define VOID void
+#endif
+
+// -------------------------------------------------------------------------
+
+typedef unsigned char UCHAR;
+typedef UCHAR *PUCHAR;
+typedef char *PSZ;
+
+typedef char CHAR;
+typedef CHAR *LPSTR, *PSTR;
+typedef CONST CHAR *LPCSTR, *PCSTR;
+
+// -------------------------------------------------------------------------
+
+typedef int INT;
+typedef unsigned int UINT;
+typedef unsigned long ULONG;
+typedef short SHORT;
+typedef unsigned short USHORT;
+typedef unsigned long ULONG;
+typedef unsigned short USHORT;
+
+typedef long LONG;
+typedef unsigned long DWORD;
+typedef int BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef float FLOAT;
+typedef double DOUBLE;
+
+typedef ULONG near *PULONG;
+typedef LONG far *LPLONG;
+typedef USHORT near *PUSHORT;
+typedef DWORD near *PDWORD;
+typedef DWORD far *LPDWORD;
+typedef WORD near *PWORD;
+typedef WORD far *LPWORD;
+typedef long far *LPLONG;
+typedef FLOAT *PFLOAT;
+typedef BOOL near *PBOOL;
+typedef BOOL far *LPBOOL;
+typedef BYTE near *PBYTE;
+typedef BYTE far *LPBYTE;
+typedef int near *PINT;
+typedef int far *LPINT;
+typedef void near *PVOID;
+typedef void far *LPVOID;
+typedef CONST void far *LPCVOID;
+typedef unsigned int *PUINT;
+
+typedef SHORT *PSHORT;
+typedef LONG *PLONG;
+
+// -------------------------------------------------------------------------
+//
+// The following types are guaranteed to be signed and 32 bits wide.
+//
+
+typedef int LONG32, *PLONG32;
+typedef int INT32, *PINT32;
+
+//
+// The following types are guaranteed to be unsigned and 32 bits wide.
+//
+
+typedef unsigned int ULONG32, *PULONG32;
+typedef unsigned int DWORD32, *PDWORD32;
+typedef unsigned int UINT32, *PUINT32;
+
+// -------------------------------------------------------------------------
+
+typedef DWORD COLORREF;
+typedef DWORD* LPCOLORREF;
+
+/* Types use for passing & returning polymorphic values */
+typedef UINT WPARAM;
+typedef LONG LPARAM;
+typedef LONG LRESULT;
+
+#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
+#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
+#define LOWORD(l) ((WORD)(l))
+#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
+#define LOBYTE(w) ((BYTE)(w))
+#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
+
+// -------------------------------------------------------------------------
+
+typedef struct tagRECT
+{
+ LONG left;
+ LONG top;
+ LONG right;
+ LONG bottom;
+} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;
+
+typedef const RECT FAR* LPCRECT;
+
+typedef struct _RECTL /* rcl */
+{
+ LONG left;
+ LONG top;
+ LONG right;
+ LONG bottom;
+} RECTL, *PRECTL, *LPRECTL;
+
+typedef const RECTL FAR* LPCRECTL;
+
+typedef struct tagPOINT
+{
+ LONG x;
+ LONG y;
+} POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;
+
+typedef struct _POINTL /* ptl */
+{
+ LONG x;
+ LONG y;
+} POINTL, *PPOINTL;
+
+typedef struct tagSIZE
+{
+ LONG cx;
+ LONG cy;
+} SIZE, *PSIZE, *LPSIZE;
+
+typedef SIZE SIZEL;
+typedef SIZE *PSIZEL, *LPSIZEL;
+
+typedef struct tagPOINTS
+{
+#ifndef _MAC
+ SHORT x;
+ SHORT y;
+#else
+ SHORT y;
+ SHORT x;
+#endif
+} POINTS, *PPOINTS, *LPPOINTS;
+
+// -------------------------------------------------------------------------
+// HRESULT
+
+#ifndef _HRESULT_DEFINED
+#define _HRESULT_DEFINED
+
+typedef LONG HRESULT;
+
+#endif // !_HRESULT_DEFINED
+
+// -------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////
+// //
+// ACCESS MASK //
+// //
+////////////////////////////////////////////////////////////////////////
+
+//
+// Define the access mask as a longword sized structure divided up as
+// follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---------------+---------------+-------------------------------+
+// |G|G|G|G|Res'd|A| StandardRights| SpecificRights |
+// |R|W|E|A| |S| | |
+// +-+-------------+---------------+-------------------------------+
+//
+// typedef struct _ACCESS_MASK {
+// WORD SpecificRights;
+// BYTE StandardRights;
+// BYTE AccessSystemAcl : 1;
+// BYTE Reserved : 3;
+// BYTE GenericAll : 1;
+// BYTE GenericExecute : 1;
+// BYTE GenericWrite : 1;
+// BYTE GenericRead : 1;
+// } ACCESS_MASK;
+// typedef ACCESS_MASK *PACCESS_MASK;
+//
+// but to make life simple for programmer's we'll allow them to specify
+// a desired access mask by simply OR'ing together mulitple single rights
+// and treat an access mask as a DWORD. For example
+//
+// DesiredAccess = DELETE | READ_CONTROL
+//
+// So we'll declare ACCESS_MASK as DWORD
+//
+
+// begin_ntddk begin_wdm begin_nthal begin_ntifs
+typedef DWORD ACCESS_MASK;
+typedef ACCESS_MASK *PACCESS_MASK;
+
+// -------------------------------------------------------------------------
+//
+// A language ID is a 16 bit value which is the combination of a
+// primary language ID and a secondary language ID. The bits are
+// allocated as follows:
+//
+// +-----------------------+-------------------------+
+// | Sublanguage ID | Primary Language ID |
+// +-----------------------+-------------------------+
+// 15 10 9 0 bit
+//
+//
+// Language ID creation/extraction macros:
+//
+// MAKELANGID - construct language id from a primary language id and
+// a sublanguage id.
+// PRIMARYLANGID - extract primary language id from a language id.
+// SUBLANGID - extract sublanguage id from a language id.
+//
+
+#define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
+#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
+#define SUBLANGID(lgid) ((WORD )(lgid) >> 10)
+
+//
+// Language IDs.
+//
+// The following two combinations of primary language ID and
+// sublanguage ID have special semantics:
+//
+// Primary Language ID Sublanguage ID Result
+// ------------------- --------------- ------------------------
+// LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral
+// LANG_NEUTRAL SUBLANG_DEFAULT User default language
+// LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language
+//
+
+//
+// Primary language IDs.
+//
+
+#define LANG_NEUTRAL 0x00
+
+#define LANG_AFRIKAANS 0x36
+#define LANG_ALBANIAN 0x1c
+#define LANG_ARABIC 0x01
+#define LANG_ARMENIAN 0x2b
+#define LANG_ASSAMESE 0x4d
+#define LANG_AZERI 0x2c
+#define LANG_BASQUE 0x2d
+#define LANG_BELARUSIAN 0x23
+#define LANG_BENGALI 0x45
+#define LANG_BULGARIAN 0x02
+#define LANG_CATALAN 0x03
+#define LANG_CHINESE 0x04
+#define LANG_CROATIAN 0x1a
+#define LANG_CZECH 0x05
+#define LANG_DANISH 0x06
+#define LANG_DUTCH 0x13
+#define LANG_ENGLISH 0x09
+#define LANG_ESTONIAN 0x25
+#define LANG_FAEROESE 0x38
+#define LANG_FARSI 0x29
+#define LANG_FINNISH 0x0b
+#define LANG_FRENCH 0x0c
+#define LANG_GEORGIAN 0x37
+#define LANG_GERMAN 0x07
+#define LANG_GREEK 0x08
+#define LANG_GUJARATI 0x47
+#define LANG_HEBREW 0x0d
+#define LANG_HINDI 0x39
+#define LANG_HUNGARIAN 0x0e
+#define LANG_ICELANDIC 0x0f
+#define LANG_INDONESIAN 0x21
+#define LANG_ITALIAN 0x10
+#define LANG_JAPANESE 0x11
+#define LANG_KANNADA 0x4b
+#define LANG_KASHMIRI 0x60
+#define LANG_KAZAK 0x3f
+#define LANG_KONKANI 0x57
+#define LANG_KOREAN 0x12
+#define LANG_LATVIAN 0x26
+#define LANG_LITHUANIAN 0x27
+#define LANG_MACEDONIAN 0x2f
+#define LANG_MALAY 0x3e
+#define LANG_MALAYALAM 0x4c
+#define LANG_MANIPURI 0x58
+#define LANG_MARATHI 0x4e
+#define LANG_NEPALI 0x61
+#define LANG_NORWEGIAN 0x14
+#define LANG_ORIYA 0x48
+#define LANG_POLISH 0x15
+#define LANG_PORTUGUESE 0x16
+#define LANG_PUNJABI 0x46
+#define LANG_ROMANIAN 0x18
+#define LANG_RUSSIAN 0x19
+#define LANG_SANSKRIT 0x4f
+#define LANG_SERBIAN 0x1a
+#define LANG_SINDHI 0x59
+#define LANG_SLOVAK 0x1b
+#define LANG_SLOVENIAN 0x24
+#define LANG_SPANISH 0x0a
+#define LANG_SWAHILI 0x41
+#define LANG_SWEDISH 0x1d
+#define LANG_TAMIL 0x49
+#define LANG_TATAR 0x44
+#define LANG_TELUGU 0x4a
+#define LANG_THAI 0x1e
+#define LANG_TURKISH 0x1f
+#define LANG_UKRAINIAN 0x22
+#define LANG_URDU 0x20
+#define LANG_UZBEK 0x43
+#define LANG_VIETNAMESE 0x2a
+
+//
+// Sublanguage IDs.
+//
+// The name immediately following SUBLANG_ dictates which primary
+// language ID that sublanguage ID can be combined with to form a
+// valid language ID.
+//
+
+#define SUBLANG_NEUTRAL 0x00 // language neutral
+#define SUBLANG_DEFAULT 0x01 // user default
+#define SUBLANG_SYS_DEFAULT 0x02 // system default
+
+#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 // Arabic (Saudi Arabia)
+#define SUBLANG_ARABIC_IRAQ 0x02 // Arabic (Iraq)
+#define SUBLANG_ARABIC_EGYPT 0x03 // Arabic (Egypt)
+#define SUBLANG_ARABIC_LIBYA 0x04 // Arabic (Libya)
+#define SUBLANG_ARABIC_ALGERIA 0x05 // Arabic (Algeria)
+#define SUBLANG_ARABIC_MOROCCO 0x06 // Arabic (Morocco)
+#define SUBLANG_ARABIC_TUNISIA 0x07 // Arabic (Tunisia)
+#define SUBLANG_ARABIC_OMAN 0x08 // Arabic (Oman)
+#define SUBLANG_ARABIC_YEMEN 0x09 // Arabic (Yemen)
+#define SUBLANG_ARABIC_SYRIA 0x0a // Arabic (Syria)
+#define SUBLANG_ARABIC_JORDAN 0x0b // Arabic (Jordan)
+#define SUBLANG_ARABIC_LEBANON 0x0c // Arabic (Lebanon)
+#define SUBLANG_ARABIC_KUWAIT 0x0d // Arabic (Kuwait)
+#define SUBLANG_ARABIC_UAE 0x0e // Arabic (U.A.E)
+#define SUBLANG_ARABIC_BAHRAIN 0x0f // Arabic (Bahrain)
+#define SUBLANG_ARABIC_QATAR 0x10 // Arabic (Qatar)
+#define SUBLANG_AZERI_LATIN 0x01 // Azeri (Latin)
+#define SUBLANG_AZERI_CYRILLIC 0x02 // Azeri (Cyrillic)
+#define SUBLANG_CHINESE_TRADITIONAL 0x01 // Chinese (Taiwan Region)
+#define SUBLANG_CHINESE_SIMPLIFIED 0x02 // Chinese (PR China)
+#define SUBLANG_CHINESE_HONGKONG 0x03 // Chinese (Hong Kong)
+#define SUBLANG_CHINESE_SINGAPORE 0x04 // Chinese (Singapore)
+#define SUBLANG_CHINESE_MACAU 0x05 // Chinese (Macau)
+#define SUBLANG_DUTCH 0x01 // Dutch
+#define SUBLANG_DUTCH_BELGIAN 0x02 // Dutch (Belgian)
+#define SUBLANG_ENGLISH_US 0x01 // English (USA)
+#define SUBLANG_ENGLISH_UK 0x02 // English (UK)
+#define SUBLANG_ENGLISH_AUS 0x03 // English (Australian)
+#define SUBLANG_ENGLISH_CAN 0x04 // English (Canadian)
+#define SUBLANG_ENGLISH_NZ 0x05 // English (New Zealand)
+#define SUBLANG_ENGLISH_EIRE 0x06 // English (Irish)
+#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 // English (South Africa)
+#define SUBLANG_ENGLISH_JAMAICA 0x08 // English (Jamaica)
+#define SUBLANG_ENGLISH_CARIBBEAN 0x09 // English (Caribbean)
+#define SUBLANG_ENGLISH_BELIZE 0x0a // English (Belize)
+#define SUBLANG_ENGLISH_TRINIDAD 0x0b // English (Trinidad)
+#define SUBLANG_ENGLISH_ZIMBABWE 0x0c // English (Zimbabwe)
+#define SUBLANG_ENGLISH_PHILIPPINES 0x0d // English (Philippines)
+#define SUBLANG_FRENCH 0x01 // French
+#define SUBLANG_FRENCH_BELGIAN 0x02 // French (Belgian)
+#define SUBLANG_FRENCH_CANADIAN 0x03 // French (Canadian)
+#define SUBLANG_FRENCH_SWISS 0x04 // French (Swiss)
+#define SUBLANG_FRENCH_LUXEMBOURG 0x05 // French (Luxembourg)
+#define SUBLANG_FRENCH_MONACO 0x06 // French (Monaco)
+#define SUBLANG_GERMAN 0x01 // German
+#define SUBLANG_GERMAN_SWISS 0x02 // German (Swiss)
+#define SUBLANG_GERMAN_AUSTRIAN 0x03 // German (Austrian)
+#define SUBLANG_GERMAN_LUXEMBOURG 0x04 // German (Luxembourg)
+#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 // German (Liechtenstein)
+#define SUBLANG_ITALIAN 0x01 // Italian
+#define SUBLANG_ITALIAN_SWISS 0x02 // Italian (Swiss)
+#define SUBLANG_KASHMIRI_INDIA 0x02 // Kashmiri (India)
+#define SUBLANG_KOREAN 0x01 // Korean (Extended Wansung)
+#define SUBLANG_LITHUANIAN 0x01 // Lithuanian
+#define SUBLANG_LITHUANIAN_CLASSIC 0x02 // Lithuanian (Classic)
+#define SUBLANG_MALAY_MALAYSIA 0x01 // Malay (Malaysia)
+#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 // Malay (Brunei Darussalam)
+#define SUBLANG_NEPALI_INDIA 0x02 // Nepali (India)
+#define SUBLANG_NORWEGIAN_BOKMAL 0x01 // Norwegian (Bokmal)
+#define SUBLANG_NORWEGIAN_NYNORSK 0x02 // Norwegian (Nynorsk)
+#define SUBLANG_PORTUGUESE 0x02 // Portuguese
+#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 // Portuguese (Brazilian)
+#define SUBLANG_SERBIAN_LATIN 0x02 // Serbian (Latin)
+#define SUBLANG_SERBIAN_CYRILLIC 0x03 // Serbian (Cyrillic)
+#define SUBLANG_SPANISH 0x01 // Spanish (Castilian)
+#define SUBLANG_SPANISH_MEXICAN 0x02 // Spanish (Mexican)
+#define SUBLANG_SPANISH_MODERN 0x03 // Spanish (Modern)
+#define SUBLANG_SPANISH_GUATEMALA 0x04 // Spanish (Guatemala)
+#define SUBLANG_SPANISH_COSTA_RICA 0x05 // Spanish (Costa Rica)
+#define SUBLANG_SPANISH_PANAMA 0x06 // Spanish (Panama)
+#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 // Spanish (Dominican Republic)
+#define SUBLANG_SPANISH_VENEZUELA 0x08 // Spanish (Venezuela)
+#define SUBLANG_SPANISH_COLOMBIA 0x09 // Spanish (Colombia)
+#define SUBLANG_SPANISH_PERU 0x0a // Spanish (Peru)
+#define SUBLANG_SPANISH_ARGENTINA 0x0b // Spanish (Argentina)
+#define SUBLANG_SPANISH_ECUADOR 0x0c // Spanish (Ecuador)
+#define SUBLANG_SPANISH_CHILE 0x0d // Spanish (Chile)
+#define SUBLANG_SPANISH_URUGUAY 0x0e // Spanish (Uruguay)
+#define SUBLANG_SPANISH_PARAGUAY 0x0f // Spanish (Paraguay)
+#define SUBLANG_SPANISH_BOLIVIA 0x10 // Spanish (Bolivia)
+#define SUBLANG_SPANISH_EL_SALVADOR 0x11 // Spanish (El Salvador)
+#define SUBLANG_SPANISH_HONDURAS 0x12 // Spanish (Honduras)
+#define SUBLANG_SPANISH_NICARAGUA 0x13 // Spanish (Nicaragua)
+#define SUBLANG_SPANISH_PUERTO_RICO 0x14 // Spanish (Puerto Rico)
+#define SUBLANG_SWEDISH 0x01 // Swedish
+#define SUBLANG_SWEDISH_FINLAND 0x02 // Swedish (Finland)
+#define SUBLANG_URDU_PAKISTAN 0x01 // Urdu (Pakistan)
+#define SUBLANG_URDU_INDIA 0x02 // Urdu (India)
+#define SUBLANG_UZBEK_LATIN 0x01 // Uzbek (Latin)
+#define SUBLANG_UZBEK_CYRILLIC 0x02 // Uzbek (Cyrillic)
+
+// -------------------------------------------------------------------------
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_WINDEF_H */

Added: sandbox/memory/boost/detail/winapi/wtypes.h
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/detail/winapi/wtypes.h 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,235 @@
+//
+// boost/detail/winapi/wtypes.h
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/detail/todo.htm for documentation.
+//
+#ifndef BOOST_DETAIL_WINAPI_WTYPES_H
+#define BOOST_DETAIL_WINAPI_WTYPES_H
+
+#if !defined(BOOST_DETAIL_NO_WINSDK)
+#error "Don't include <winapi/wtypes.h>"
+#endif
+
+#ifndef BOOST_DETAIL_WINAPI_WINDEF_H
+#include "windef.h"
+#endif
+
+// =========================================================================
+
+typedef unsigned char byte;
+typedef wchar_t WCHAR;
+
+typedef WCHAR OLECHAR;
+typedef OLECHAR* LPOLESTR;
+typedef const OLECHAR* LPCOLESTR;
+typedef OLECHAR* BSTR;
+typedef double DATE;
+
+// =========================================================================
+
+#if defined(_UNICODE)
+typedef WCHAR TCHAR;
+#else
+typedef CHAR TCHAR;
+#endif
+
+// =========================================================================
+
+typedef /* [string] */ WCHAR __RPC_FAR *LPWSTR;
+
+typedef /* [string] */ TCHAR __RPC_FAR *LPTSTR;
+
+typedef /* [string] */ const WCHAR __RPC_FAR *LPCWSTR;
+
+typedef /* [string] */ const TCHAR __RPC_FAR *LPCTSTR;
+
+// =========================================================================
+
+#if defined(__GNUG__)
+typedef long long __int64;
+typedef unsigned long long __uint64;
+#endif
+
+typedef __int64 LONG64, *PLONG64;
+typedef __int64 INT64, *PINT64;
+
+typedef __uint64 ULONG64, *PULONG64;
+typedef __uint64 DWORD64, *PDWORD64;
+typedef __uint64 UINT64, *PUINT64;
+
+typedef __int64 LONGLONG;
+typedef __uint64 ULONGLONG;
+
+// =========================================================================
+
+typedef union _LARGE_INTEGER {
+ struct {
+ DWORD LowPart;
+ LONG HighPart;
+ };
+ struct {
+ DWORD LowPart;
+ LONG HighPart;
+ } u;
+ LONGLONG QuadPart;
+} LARGE_INTEGER;
+
+typedef union _ULARGE_INTEGER {
+ struct {
+ DWORD LowPart;
+ DWORD HighPart;
+ };
+ struct {
+ DWORD LowPart;
+ DWORD HighPart;
+ } u;
+ ULONGLONG QuadPart;
+} ULARGE_INTEGER;
+
+typedef ULARGE_INTEGER *PULARGE_INTEGER;
+
+// =========================================================================
+
+#ifndef _FILETIME_
+#define _FILETIME_
+
+typedef struct _FILETIME
+ {
+ DWORD dwLowDateTime;
+ DWORD dwHighDateTime;
+ } FILETIME;
+
+typedef struct _FILETIME __RPC_FAR *PFILETIME;
+typedef struct _FILETIME __RPC_FAR *LPFILETIME;
+
+#endif // !_FILETIME
+
+#ifndef _SYSTEMTIME_
+#define _SYSTEMTIME_
+
+typedef struct _SYSTEMTIME
+ {
+ WORD wYear;
+ WORD wMonth;
+ WORD wDayOfWeek;
+ WORD wDay;
+ WORD wHour;
+ WORD wMinute;
+ WORD wSecond;
+ WORD wMilliseconds;
+ } SYSTEMTIME;
+
+typedef struct _SYSTEMTIME __RPC_FAR *PSYSTEMTIME;
+typedef struct _SYSTEMTIME __RPC_FAR *LPSYSTEMTIME;
+
+#endif // !_SYSTEMTIME
+
+// -------------------------------------------------------------------------
+
+#ifndef _SECURITY_ATTRIBUTES_
+#define _SECURITY_ATTRIBUTES_
+typedef struct _SECURITY_ATTRIBUTES
+ {
+ DWORD nLength;
+ /* [size_is] */ LPVOID lpSecurityDescriptor;
+ BOOL bInheritHandle;
+ } SECURITY_ATTRIBUTES;
+
+typedef struct _SECURITY_ATTRIBUTES __RPC_FAR *PSECURITY_ATTRIBUTES;
+typedef struct _SECURITY_ATTRIBUTES __RPC_FAR *LPSECURITY_ATTRIBUTES;
+
+#endif // !_SECURITY_ATTRIBUTES_
+
+// =========================================================================
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(1)
+typedef struct _GUID
+{
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+} GUID;
+#pragma pack()
+
+typedef GUID IID;
+typedef GUID CLSID;
+
+typedef CLSID __RPC_FAR* LPCLSID;
+typedef IID __RPC_FAR* LPIID;
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+// =========================================================================
+
+typedef const IID& REFIID;
+typedef const CLSID& REFCLSID;
+typedef const GUID& REFGUID;
+
+// =========================================================================
+// HANDLE
+
+#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+
+DECLARE_HANDLE(HINSTANCE);
+
+typedef PVOID HANDLE;
+typedef HINSTANCE HMODULE; /* HMODULEs can be used in place of HINSTANCEs */
+
+typedef HANDLE HGLOBAL;
+typedef HANDLE HLOCAL;
+
+typedef /* [wire_marshal] */ void __RPC_FAR *HMETAFILEPICT;
+
+// -------------------------------------------------------------------------
+
+DECLARE_HANDLE(HGDIOBJ);
+DECLARE_HANDLE(HBITMAP);
+DECLARE_HANDLE(HBRUSH);
+DECLARE_HANDLE(HDC);
+DECLARE_HANDLE(HFONT);
+DECLARE_HANDLE(HICON);
+DECLARE_HANDLE(HCURSOR);
+DECLARE_HANDLE(HMENU);
+DECLARE_HANDLE(HPALETTE);
+DECLARE_HANDLE(HPEN);
+DECLARE_HANDLE(HRGN);
+DECLARE_HANDLE(HRSRC);
+DECLARE_HANDLE(HSTR);
+DECLARE_HANDLE(HTASK);
+DECLARE_HANDLE(HWINSTA);
+DECLARE_HANDLE(HKL);
+DECLARE_HANDLE(HACCEL);
+
+DECLARE_HANDLE(HGLRC); // OpenGL
+DECLARE_HANDLE(HDESK);
+DECLARE_HANDLE(HMETAFILE);
+DECLARE_HANDLE(HENHMETAFILE);
+
+// -------------------------------------------------------------------------
+
+DECLARE_HANDLE(HKEY);
+typedef HKEY *PHKEY;
+
+//
+// Requested Key access mask type.
+//
+
+typedef ACCESS_MASK REGSAM;
+
+// =========================================================================
+// $Log: $
+
+#endif /* BOOST_DETAIL_WINAPI_WTYPES_H */

Modified: sandbox/memory/boost/memory/basic.hpp
==============================================================================
--- sandbox/memory/boost/memory/basic.hpp (original)
+++ sandbox/memory/boost/memory/basic.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -30,6 +30,10 @@
 #include <crtdbg.h> // _CrtSetDbgFlag
 #endif
 
+#ifndef BOOST_DETAIL_DEBUG_HPP
+#include "../detail/debug.hpp"
+#endif
+
 #pragma pack() // default pack
 #pragma warning(disable:4786)
 // warning: identifier was truncated to '255' characters in the debug information
@@ -50,6 +54,12 @@
 
 // -------------------------------------------------------------------------
 
+#ifndef BOOST_MEMORY_ASSERT
+#define BOOST_MEMORY_ASSERT(e) BOOST_DETAIL_ASSERT(e)
+#endif
+
+// -------------------------------------------------------------------------
+
 #if defined(BOOST_NO_PARTIAL_SPECIAILIZATION)
         #define BOOST_MEMORY_NO_PARTIAL_SPECIAILIZATION
 #elif defined(_MSC_VER)
@@ -59,24 +69,6 @@
 #endif
 
 // =========================================================================
-// BOOST_MEMORY_ASSERT - diagnost
-
-#if defined(ASSERT)
-#define BOOST_MEMORY_ASSERT(e) ASSERT(e)
-#elif defined(_ASSERTE)
-#define BOOST_MEMORY_ASSERT(e) _ASSERTE(e)
-#else
-#ifdef _DEBUG
-#ifndef assert
-#include <cassert>
-#endif
-#define BOOST_MEMORY_ASSERT(e) assert(e)
-#else
-#define BOOST_MEMORY_ASSERT(e)
-#endif
-#endif
-
-// =========================================================================
 // Configurations
 
 #ifndef BOOST_MEMORY_ALLOC_PADDING
@@ -291,18 +283,6 @@
 #endif
 }
 
-template <class StrucType>
-inline bool BOOST_MEMORY_CALL isInitialized(const StrucType& stru)
-{
- const char* p = (const char*)&stru;
- for (size_t i = 0; i < sizeof(stru); ++i)
- {
- if (p[i] != 0)
- return true;
- }
- return false;
-}
-
 NS_BOOST_MEMORY_END
 
 // =========================================================================

Modified: sandbox/memory/boost/memory/policy.hpp
==============================================================================
--- sandbox/memory/boost/memory/policy.hpp (original)
+++ sandbox/memory/boost/memory/policy.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -133,7 +133,7 @@
 public:
         enum { MemBlockSize = BOOST_MEMORY_BLOCK_SIZE };
         typedef system_alloc allocator_type;
- typedef default_threadmodel threadmodel_type;
+ typedef NS_BOOST_DETAIL::default_threadmodel threadmodel_type;
 
         enum { RecycleSizeMin = 256 };
         enum { AllocSizeBig = Default };

Modified: sandbox/memory/boost/memory/system_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/system_alloc.hpp (original)
+++ sandbox/memory/boost/memory/system_alloc.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -16,8 +16,8 @@
 #include "basic.hpp"
 #endif
 
-#ifndef BOOST_MEMORY_THREADMODEL_HPP
-#include "threadmodel.hpp"
+#ifndef BOOST_DETAIL_THREADMODEL_HPP
+#include "../detail/threadmodel.hpp"
 #endif
 
 #if !defined(_ALGORITHM_) && !defined(_ALGORITHM)

Modified: sandbox/memory/boost/memory/thread/tls.hpp
==============================================================================
--- sandbox/memory/boost/memory/thread/tls.hpp (original)
+++ sandbox/memory/boost/memory/thread/tls.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -16,8 +16,8 @@
 #include "../basic.hpp"
 #endif
 
-#ifndef BOOST_MEMORY_THREADMODEL_HPP
-#include "../threadmodel.hpp"
+#ifndef BOOST_DETAIL_THREADMODEL_HPP
+#include "../../detail/threadmodel.hpp"
 #endif
 
 // -------------------------------------------------------------------------
@@ -146,7 +146,7 @@
 template <
         class Type,
         class Factory = tls_factory<Type>,
- class ThreadModel = initializer_threadmodel>
+ class ThreadModel = NS_BOOST_DETAIL::default_threadmodel>
 class tls_object
 {
 private:

Deleted: sandbox/memory/boost/memory/threadmodel.hpp
==============================================================================
--- sandbox/memory/boost/memory/threadmodel.hpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
+++ (empty file)
@@ -1,95 +0,0 @@
-//
-// boost/memory/threadmodel.hpp (*)
-//
-// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/memory/index.htm for documentation.
-//
-#ifndef BOOST_MEMORY_THREADMODEL_HPP
-#define BOOST_MEMORY_THREADMODEL_HPP
-
-// -------------------------------------------------------------------------
-
-#ifndef BOOST_MEMORY_THREADMODEL_SINGLE_THREAD_H
-#include "threadmodel/single_thread.hpp"
-#endif
-
-#ifndef BOOST_MEMORY_THREADMODEL_MULTI_THREAD_H
-#include "threadmodel/multi_thread.hpp"
-#endif
-
-NS_BOOST_MEMORY_BEGIN
-
-// -------------------------------------------------------------------------
-// class auto_lock
-
-template <class LockT>
-class auto_lock
-{
-private:
- LockT& m_lock;
-
-private:
- auto_lock(const auto_lock&);
- void operator=(const auto_lock&);
-
-public:
- auto_lock(LockT& lock) : m_lock(lock)
- {
- m_lock.acquire();
- }
- ~auto_lock()
- {
- m_lock.release();
- }
-};
-
-// -------------------------------------------------------------------------
-// class multi_thread
-
-class multi_thread
-{
-public:
- typedef refcount_mt refcount;
- typedef critical_section_mt critical_section;
-
-public:
- typedef critical_section cs;
- typedef auto_lock<cs> cslock;
-};
-
-// -------------------------------------------------------------------------
-// class single_thread
-
-class single_thread
-{
-public:
- typedef refcount_st refcount;
- typedef critical_section_st critical_section;
-
-public:
- typedef critical_section cs;
- typedef auto_lock<cs> cslock;
-};
-
-// -------------------------------------------------------------------------
-// class default_threadmodel
-
-#if defined(_MT)
-typedef multi_thread default_threadmodel;
-#else
-typedef single_thread default_threadmodel;
-#endif
-
-typedef single_thread initializer_threadmodel;
-
-// -------------------------------------------------------------------------
-// $Log: $
-
-NS_BOOST_MEMORY_END
-
-#endif /* BOOST_MEMORY_THREADMODEL_HPP */

Added: sandbox/memory/libs/memory/test/test_basic/memory/performance.cpp
==============================================================================
--- (empty file)
+++ sandbox/memory/libs/memory/test/test_basic/memory/performance.cpp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -0,0 +1,234 @@
+//
+// performance.cpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#include <boost/memory.hpp>
+#include <boost/detail/performance_counter.hpp>
+
+#if defined(__GNUG__)
+#include <ext/mt_allocator.h>
+#include <boost/pool/pool.hpp>
+#include <boost/pool/object_pool.hpp>
+#endif
+
+// -------------------------------------------------------------------------
+
+template <class LogT>
+class TestAllocatorPerformance
+{
+private:
+ NS_BOOST_DETAIL::accumulator m_acc;
+ NS_BOOST_MEMORY::block_pool m_recycle;
+
+public:
+ void doNewDelete(LogT& log, int NAlloc, int PerAlloc)
+ {
+ int i, **p;
+ p = new int*[PerAlloc];
+ NS_BOOST_DETAIL::performance_counter counter;
+ {
+ for (int j = 0; j < NAlloc; ++j)
+ {
+ for (i = 0; i < PerAlloc; ++i)
+ {
+ p[i] = new int;
+ }
+ for (i = 0; i < PerAlloc; ++i)
+ {
+ delete p[i];
+ }
+ }
+ }
+ m_acc.accumulate(counter.trace(log));
+ delete[] p;
+ }
+
+#if defined(__GNUG__)
+ void doMtAllocator(LogT& log, int NAlloc, int PerAlloc)
+ {
+ typedef __gnu_cxx::__mt_alloc<int> allocator_type;
+ typedef __gnu_cxx::__pool_base::_Tune tune_type;
+ //tune_type tune(16, 5120, 32, 5120, 20, 10, false);
+
+ int i, **p;
+ p = new int*[PerAlloc];
+ NS_BOOST_DETAIL::performance_counter counter;
+ {
+ for (int j = 0; j < NAlloc; ++j)
+ {
+ allocator_type alloc;
+ //alloc._M_set_options(tune);
+ for (i = 0; i < PerAlloc; ++i)
+ {
+ p[i] = alloc.allocate(1);
+ }
+ for (i = 0; i < PerAlloc; ++i)
+ {
+ alloc.deallocate(p[i], 1);
+ }
+ }
+ }
+ m_acc.accumulate(counter.trace(log));
+ delete[] p;
+ }
+
+ void doBoostPool(LogT& log, int NAlloc, int PerAlloc)
+ {
+ NS_BOOST_DETAIL::performance_counter counter;
+ {
+ for (int j = 0; j < NAlloc; ++j)
+ {
+ boost::pool<> alloc(sizeof(int));
+ for (int i = 0; i < PerAlloc; ++i)
+ {
+ int* p = (int*)alloc.malloc();
+ }
+ }
+ }
+ m_acc.accumulate(counter.trace(log));
+ }
+
+ void doBoostObjectPool(LogT& log, int NAlloc, int PerAlloc)
+ {
+ NS_BOOST_DETAIL::performance_counter counter;
+ {
+ for (int j = 0; j < NAlloc; ++j)
+ {
+ boost::object_pool<int> alloc;
+ for (int i = 0; i < PerAlloc; ++i)
+ {
+ int* p = alloc.construct();
+ }
+ }
+ }
+ m_acc.accumulate(counter.trace(log));
+ }
+#endif
+
+ template <class LogT2>
+ void doAutoAlloc(LogT2& log, int NAlloc, int PerAlloc)
+ {
+ NS_BOOST_DETAIL::performance_counter counter;
+ {
+ for (int j = 0; j < NAlloc; ++j)
+ {
+ boost::auto_alloc alloc;
+ for (int i = 0; i < PerAlloc; ++i)
+ {
+ int* p = STD_NEW(alloc, int);
+ }
+ }
+ }
+ m_acc.accumulate(counter.trace(log));
+ }
+
+ template <class LogT2>
+ void doTlsScopedAlloc(LogT2& log, int NAlloc, int PerAlloc)
+ {
+ NS_BOOST_DETAIL::performance_counter counter;
+ {
+ for (int j = 0; j < NAlloc; ++j)
+ {
+ boost::scoped_alloc alloc;
+ for (int i = 0; i < PerAlloc; ++i)
+ {
+ int* p = STD_NEW(alloc, int);
+ }
+ }
+ }
+ m_acc.accumulate(counter.trace(log));
+ }
+
+ template <class LogT2>
+ void doScopedAlloc(LogT2& log, int NAlloc, int PerAlloc)
+ {
+ NS_BOOST_DETAIL::performance_counter counter;
+ {
+ for (int j = 0; j < NAlloc; ++j)
+ {
+ boost::scoped_alloc alloc(m_recycle);
+ for (int i = 0; i < PerAlloc; ++i)
+ {
+ int* p = STD_NEW(alloc, int);
+ }
+ }
+ }
+ m_acc.accumulate(counter.trace(log));
+ }
+
+ void doComparison(LogT& log, int Total, int NAlloc)
+ {
+ int i;
+ const int Count = 16;
+ const int PerAlloc = Total / NAlloc;
+
+ m_acc.start();
+ log.print(PerAlloc, "\n===== boost::auto_alloc(%d) =====\n");
+ for (i = 0; i < Count; ++i)
+ doAutoAlloc(log, NAlloc, PerAlloc);
+ m_acc.trace_avg(log);
+
+ m_acc.start();
+ log.print(PerAlloc, "\n===== TLS boost::scoped_alloc(%d) =====\n");
+ for (i = 0; i < Count; ++i)
+ doTlsScopedAlloc(log, NAlloc, PerAlloc);
+ m_acc.trace_avg(log);
+
+ m_acc.start();
+ log.print(PerAlloc, "\n===== boost::scoped_alloc(%d) =====\n");
+ for (i = 0; i < Count; ++i)
+ doScopedAlloc(log, NAlloc, PerAlloc);
+ m_acc.trace_avg(log);
+
+#if defined(__GNUG__)
+ m_acc.start();
+ log.print(PerAlloc, "\n===== MtAllocator(%d) =====\n");
+ for (i = 0; i < Count; ++i)
+ doMtAllocator(log, NAlloc, PerAlloc);
+ m_acc.trace_avg(log);
+
+ m_acc.start();
+ log.print(PerAlloc, "\n===== BoostPool(%d) =====\n");
+ for (i = 0; i < Count; ++i)
+ doBoostPool(log, NAlloc, PerAlloc);
+ m_acc.trace_avg(log);
+
+ m_acc.start();
+ log.print(PerAlloc, "\n===== BoostObjectPool(%d) =====\n");
+ for (i = 0; i < Count; ++i)
+ doBoostObjectPool(log, NAlloc, PerAlloc);
+ m_acc.trace_avg(log);
+#endif
+
+ m_acc.start();
+ log.print(PerAlloc, "\n===== NewDelete(%d) =====\n");
+ for (i = 0; i < Count; ++i)
+ doNewDelete(log, NAlloc, PerAlloc);
+ m_acc.trace_avg(log);
+ }
+
+ void testComparison(LogT& log)
+ {
+ NS_BOOST_DETAIL::null_log nullLog;
+
+ const int Total = 1000000;
+ doAutoAlloc(nullLog, Total, 1);
+ doTlsScopedAlloc(nullLog, Total, 1);
+ doScopedAlloc(nullLog, Total, 1);
+
+ doComparison(log, Total, Total);
+ doComparison(log, Total, 1000);
+ doComparison(log, Total, 1);
+ }
+};
+
+// -------------------------------------------------------------------------
+// $Log: performance.cpp,v $
+//

Modified: sandbox/memory/libs/memory/test/test_basic/test.dsp
==============================================================================
--- sandbox/memory/libs/memory/test/test_basic/test.dsp (original)
+++ sandbox/memory/libs/memory/test/test_basic/test.dsp 2008-05-06 05:09:51 EDT (Tue, 06 May 2008)
@@ -86,6 +86,10 @@
 # Name "test - Win32 Debug"
 # Begin Source File
 
+SOURCE=.\memory\performance.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\memory\simple_examples.cpp
 # End Source File
 # Begin Source File


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk