LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using thread safety variable

Hello ,

My coding is as this :
DefineThreadSafeScalarVar(struct dTagPack ,dGlobel,0);
struct dTagPack *dGlobel = NULL;

...
int main (...)
{
...;
}

int CVICALLBACK Mycallback (int panel, int control, int event,void *callbackData, int eventData1, int eventData2)
{
struct dTagPack *root;
struct dTagPack rr;
...
dGlobel = ExportLink() ;//get a link from a dll file
InitializedGlobel();
root = GetPointerTodGlobel();
rr = root[0];
.....;
ReleasePointerTodGlobel();
UninitiallizedGlobel();
return 0;
}

When view the value of variable rr , its elements are all equal zero , but check variable of dGlobel , its value is correct . I am not sure if the TSV would modify the value .

David
0 Kudos
Message 1 of 2
(2,556 Views)
David,

I don't see how the TSV would change the value of rr here. But it depends on what you do in GetPointerTodGlobel(). There is a good document on TSV that you can find in:
http://zone.ni.com/devzone/conceptd.nsf/webmain/2DF76D8073AA2A8C86256D2C005586D2?opendocument#4

It contains a good example for TSV, but again I don't see how rr will be modified here.

Hope that helps.

Juan Carlos
N.I.
0 Kudos
Message 2 of 2
(2,556 Views)