Shared global variable blocks, Shared global variable blocks -53 – National Instruments AutoCode NI MATRIX User Manual

Page 161

Advertising
background image

Chapter 5

Generated Code Architecture

© National Instruments Corporation

5-53

AutoCode Reference

The formal argument represents the global reference number for which the
variable block is being accessed. The second formal argument,

caller_id

, represents a unique identifier for the caller. The default

implementation of those simply calls the

Enable( )

function.

The following code uses the

Enter_Local_Varblk...

syntax to call

non-shared global variable block generated code with callouts, using the

-vbco

and

-epi

options.

Enter_Local_Varblk_Section(4, 1);

proc2_4_1 = block5[0];

proc2_4_2 = block5[1];

Leave_Local_Varblk_Section(4, 1);

Shared Global Variable Blocks

Variable blocks are defined as shared if more than one processor accesses
that variable block. There are sets of callouts for shared variable block
accesses. For a discussion of code generation for shared variable blocks,
refer to the

Shared Variable Block Support

section.

Entering Shared Critical Section

The prototype of the callout for entering a shared variable block critical
section is:

void Enter_Shared_Varblk_Section(RT_INTEGER processor, RT_INTEGER index);

procedure Enter_Shared_Varblk_Section(processor : RT_INTEGER;

index : RT_INTEGER);

The first formal argument represents which processor the access is taking
place on. Processor numbers are 1-based. The second formal argument
represents the global reference number for which the variable block is
being accessed.

Leaving Shared Critical Section

The prototype of the callout for leaving a local variable block critical
section is:

void Leave_Shared_Varblk_Section(RT_INTEGER processor, RT_INTEGER index);

procedure Leave_Shared_Varblk_Section(processor : RT_INTEGER;

index : RT_INTEGER);

Advertising