All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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:

void process(GA_RWAttributeRef &write, GA_ROAttributeRef &read)
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 806 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 809 of file GA_Attribute.h.

GA_AutoHardenForThreading::~GA_AutoHardenForThreading ( )

Definition at line 818 of file GA_Attribute.h.

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