On 01/02/2016 at 17:09, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) :
---------
Hello! I want to implement multi processing for my VideoPostData plugin. It uses
VolumeData::TraceGeometryEnhanced() and VolumeData::GetSurfaceData(). I tried
to create a copy of the VolumeData before using these functions in the thread, but
I still get access violations when I don't synchronize calls to these functions using a lock.
// Create a copy of the VolumeData, it can not be accessed from
// several threads simultaneously.
lock_.Lock();
AutoAlloc<VolumeData> vd;
if (!vd) {
lock_.Unlock();
GePrint("Could not allocate VolumeData.");
return;
}
info.vps->vd->CopyTo(vd); // XXX does not return a value? How to check for success?
lock_.Unlock();
And later in the code
lock_.Lock();
vd->GetSurfaceData(&sd, false, false, false, true, &ray, si); // <-- access violation if locking is removed
lock_.Unlock();
It used to work in a single threaded process. How do I correctly clone a VolumeData?
Thanks in advance!
Niklas