aspringstroh

Threading

Discussion created by aspringstroh on Dec 1, 2011
Latest reply on Dec 5, 2011 by charlie@osisoft.com

If a class has fields PISDK and Server that are created during the constructor of said class, can you spin out threads within the constructor that call methods that make use of the same Server class field?

 

 

 

class Test
{

    PISDK.PISDK myPISDK = new PISDK.PISDK();
    PISDK.Server myPIServer;
    
    public Test()
    {
        myPIServer = myPISDK.Servers.DefaultServer;
        SpinThreads();
    }
    ~Test()
    {
        myPIServer.Close();
    }
    private void SpinThreads()
    {
        //Create threads that use 
        PISDK.PIPoint myPIPoint = myPIServer.PIPoints[tagname];
    }
}

 Is this safe?

 

 

 

 

Outcomes