Re: C++ Memory Management Innovation: GC Allocator
  Home FAQ Contact Sign in
comp.lang.c++.moderated only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: C++ Memory Management Innovation: GC Allocator         

Group: comp.lang.c++.moderated · Group Profile
Author: xushiwei
Date: Apr 25, 2008 08:52

On Apr 24, 3:43 pm, "Chris Thomasson" comcast.net> wrote:
>
> There are benefits for using TLS. Think of a simple contrived scenario like:
>
> void function() {
> // I need to allocate from m_alloc...
> // How can I do this without adding any parameters?
>
> }
>
> void thread() {
> GenericAllocator m_alloc;
> function();
>
> }
>
> AFAICT, your allocator can use TLS as-is... Basically, something like:
>
> void function() {
> GenericAllocator* const pm_alloc = pthread_getspecific(...);
> // Now I can allocate from m_alloc! :^D
>
> }
>
> void thread() {
> GenericAllocator m_alloc;
> pthread_setspecific(..., &m_alloc);
> function();
>
> }
>
> Don't you think that your design could "possibly" benefit from using TLS?
> IMVHO, it would increase its flexibility...
>
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
no comments
diggit! del.icio.us! reddit!