access to SeismicCube from another thread

57 Views Asked by At

i'm using thread to launch on background a function using SeismicCube

public class JobSetup
{
    public SeismicCube cube;
}

public void Function1(SeismicCube cube)
{    
    var jobSetup = new JobSetup();
    jobSetup.cube = cube;
    var th = new Thread(new ParameterizedThreadStart(ThreadFunc));
    th.Start(jobSetup); 
}     

public void ThreadFunc(object state)
{
    var jobSetup = (JobSetup)state;
    ...
    ...
    Point3 new_p = jobSetup.cube.PositionAtIndex(new IndexDouble3(y, x, z));
}

Because Petrel is a single-threaded application, all access to native Petrel domain objects must take place on the main thread. Otherwise, you receive this run-time error:

System.InvalidOperationException was unhandled Message=”Cross-thread operation not valid: Application accessed domain object from a thread other than the main thread.” Source=”Slb.Ocean.Petrel.DomainObject”

0

There are 0 best solutions below