All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AutoHardenForThreading Class Reference

Automatically expand attribute data pages for threading. More...

#include <GA_Attribute.h>

Public Member Functions

 GA_AutoHardenForThreading (GA_Attribute &attribute, GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET)
 ~GA_AutoHardenForThreading ()

Detailed Description

Automatically expand attribute data pages for threading.

Normally, threading is allowed only if each thread is guaranteed to write to an individual page of data. Not all algorithms are amenable to this constraint. Using the GA_AutoThreadExpand class will force the attribute to harden all its data pages so that multiple threads can write across page boundaries. Multiple threads are still prohibited from writing to the same offset. In its destructor, the class will automatically call the compress method to regain memory efficiency. For example:

GA_AutoHardenForThreading thread_write(*write.getAttribute());
// There's no need to harden the read-only attribute, but now that
// we've hardened the write attribute, our threaded algorithm is able
// to write data across page boundaries.
UTparallelFor(range, functor(write, read));

Definition at line 867 of file GA_Attribute.h.

Constructor & Destructor Documentation

GA_AutoHardenForThreading::GA_AutoHardenForThreading ( GA_Attribute attribute,
GA_Offset  start_offset = GA_Offset(0),
GA_Offset  end_offset = GA_INVALID_OFFSET 

Definition at line 870 of file GA_Attribute.h.

GA_AutoHardenForThreading::~GA_AutoHardenForThreading ( )

Definition at line 879 of file GA_Attribute.h.

The documentation for this class was generated from the following file: