Boost logo

Boost-Commit :

From: xushiweizh_at_[hidden]
Date: 2008-04-28 22:58:26


Author: xushiwei
Date: 2008-04-28 22:58:26 EDT (Mon, 28 Apr 2008)
New Revision: 44871
URL: http://svn.boost.org/trac/boost/changeset/44871

Log:
use global variable to initialize _tls_block_pool.
Removed:
   sandbox/memory/libs/memory/memory.cpp
Text files modified:
   sandbox/memory/libs/memory/memory.dsp | 4 ----
   sandbox/memory/libs/memory/src/block_pool.cpp | 12 ++++++++++++
   2 files changed, 12 insertions(+), 4 deletions(-)

Deleted: sandbox/memory/libs/memory/memory.cpp
==============================================================================
--- sandbox/memory/libs/memory/memory.cpp 2008-04-28 22:58:26 EDT (Mon, 28 Apr 2008)
+++ (empty file)
@@ -1,34 +0,0 @@
-// memory.cpp : Defines the entry point for the DLL application.
-//
-
-#include "stdafx.h"
-#include <boost/memory/scoped_alloc.hpp>
-
-// -------------------------------------------------------------------------
-
-using namespace boost;
-
-extern tls_block_pool_t _tls_blockPool;
-
-#if defined(_WIN32)
-
-BOOL APIENTRY DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- _tls_blockPool.init();
- break;
- case DLL_PROCESS_DETACH:
- _tls_blockPool.term();
- break;
- }
- return TRUE;
-}
-
-#endif
-
-// -------------------------------------------------------------------------

Modified: sandbox/memory/libs/memory/memory.dsp
==============================================================================
--- sandbox/memory/libs/memory/memory.dsp (original)
+++ sandbox/memory/libs/memory/memory.dsp 2008-04-28 22:58:26 EDT (Mon, 28 Apr 2008)
@@ -100,10 +100,6 @@
 # PROP Default_Filter ""
 # Begin Source File
 
-SOURCE=.\memory.cpp
-# End Source File
-# Begin Source File
-
 SOURCE=.\memory_w32.def
 # End Source File
 # Begin Source File

Modified: sandbox/memory/libs/memory/src/block_pool.cpp
==============================================================================
--- sandbox/memory/libs/memory/src/block_pool.cpp (original)
+++ sandbox/memory/libs/memory/src/block_pool.cpp 2008-04-28 22:58:26 EDT (Mon, 28 Apr 2008)
@@ -24,4 +24,16 @@
 }
 
 // -------------------------------------------------------------------------
+// class tls_block_pool_init
+
+class tls_block_pool_init
+{
+public:
+ tls_block_pool_init() { _tls_blockPool.init(); }
+ ~tls_block_pool_init() { _tls_blockPool.term(); }
+};
+
+tls_block_pool_init _tls_blockPoolInit;
+
+// -------------------------------------------------------------------------
 // $Log: $


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