maxpayne Posted June 24 Share Posted June 24 (edited) Hi everyone. I'm trying to use UT_ThreadSpecificValue inside Threaded loop using UT_Parallel_for. Every thread supposed to have some variable that is accumulated and after loop it's being summed up. It all seems to work but it looks like values that are being accumulated indefinitely. What is the correct way of using it ? I tried to set UT_ThreadSpecificValue back to 0.0 but looks like it doesn't do much. Any help would be appreciated. Code example: static UT_ThreadSpecificValue<UT_Vector3D> temp GA_SplittableRange point_range(gdp->getPointRange()); UTparallelFor(point_range, [&](const GA_SplittableRange& r) { setting variables... for (GA_Iterator it(r.begin()); !it.atEnd(); ++it) { GA_Offset ptoff = *it; UT_Vector3D myVector = temp.get(); myVector+=1; temp.get()=myVector; } for (UT_Vector3D value : temp) { x_var+= temp.x(); y_var+= temp.y(); z_var+= temp.z(); } ... UPDATE: resetting values with temp.clear() before loop works but whenever I change any parameter on a node repeatedly , Houdini crashes. Edited June 24 by maxpayne Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.