LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When Writing LabView GOOP code, what is the appropriate policy for when data should be locked since a private method cannot lock or access data if a public method that calles it has already locked the data?

Do not access the data repository from a private method, simply use a wire to pass the data.
greetings from the Netherlands
0 Kudos
Message 2 of 6
(3,045 Views)
Thanks Al,

That is what I surmised but it was not stated explicitly in any NI GOOP liturature.

So then, private methods are used in public methods or other private menthods and pass data between each other by wiring them together as usual. Public methods lock the atributes if it will change them and public methods can call other public methods only if it doesn't lock the atributes and if it is not critical that this entire method be completed before the atributes are changed by another process.

I have not noticed this connection between locking of atributes and public/private methods before in other languages like Java where locking and unlocking are handled automatically (I think).

Thanks again,

MAC
0 Kudos
Message 4 of 6
(3,045 Views)
Thanks Al,

That is what I surmised but it was not stated explicitly in any NI GOOP liturature.

So then, private methods are used in public methods or other private menthods and pass data between each other by wiring them together as usual. Public methods lock the atributes if it will change them and public methods can call other public methods only if it doesn't lock the atributes and if it is not critical that this entire method be completed before the atributes are changed by another process.

I have not noticed this connection between locking of atributes and public/private methods before in other languages like Java where locking and unlocking are handled automatically (I think).

Thanks again,

MAC
0 Kudos
Message 5 of 6
(3,045 Views)
If your private method has more than a few inputs and you don't want to have a bunch of wires connecting from the public vi into the private one here is what i do. On the front panel of the private method right click and select the dialog box for selecting a user defined control. Then go to the class (library) the private fuinction resides and select 'classname data object.ctl'. Putting two of these (one control and one indicator) on the front panel and connecting them to terminals will allow you to directly wire the cluster from the public method in and out. Also, if you update the data memeber control, this private method will be updated also.

Jared
Message 3 of 6
(3,045 Views)