Chapter 5
Generated Code Architecture
©
National Instruments Corporation
5-51
proc2_4_2 = Read_Shared_Varblk_Float(&isi_varblk[0]->block5[1]);
Leave_Shared_Varblk_Section(4);
/* ------------------------------- Write to Variable */
Enter_Shared_Varblk_Section(4);
Write_Shared_Varblk_Float(&isi_varblk[0]->block5[0], proc2_4_1);
Write_Shared_Varblk_Float(&isi_varblk[0]->block5[1], proc2_4_2);
Leave_Shared_Varblk_Section(4);
Global Variable Block Callouts
Callouts are generated around each variable block access when the
-vbco
option is specified. These callouts define a critical section region for the
variable block and let you implement some type of exclusion scheme to
protect the integrity of the variable block variable access, if necessary.
When callouts are used for single- or multiple-processor code generation,
the provided implementation of the callouts does absolutely nothing.
Callout Pairs
There are different variations of the callouts to suit different code
generation specifications. The callouts are grouped together into pairs.
A pair of callouts is used to surround the variable block access. One
function of the pair represents the entry into the critical region and the
other represents the leaving of the region. There are four different pairs for
different code generation configurations. The choice of which pair depends
on whether the variable block is shared among multiple processors and
whether the
-epi
option is used.
Non-Shared (Local) Global Variable Blocks
A variable block is defined as non-shared if only one processor accesses
that variable block. By definition, all variable block accesses for
single-processor code generation are non-shared. There are sets of callouts
for non-shared variable block accesses. Notice that the term local variable
block was previously used to describe a non-shared variable block.
Entering Non-Shared (Local) Critical Section
The prototype of the callout for entering a non-shared global variable block
critical section is:
void Enter_Local_Varblk_Section(RT_INTEGER index);
procedure Enter_Local_Varblk_Section(index :
RT_INTEGER);