Example, Resp_alloc( ) built-in function, Syntax – Echelon Neuron C User Manual

Page 143: Resp_cancel( ) built-in function

Advertising
background image

Neuron C Reference Guide

123

Example

void f(void)
{
unsigned

value;

...

value = random();

}

resp_alloc( )

Built-in Function

The resp_alloc( ) built-in function allocates an object for an outgoing response.

The function returns TRUE if a resp_out object can be allocated. The function

returns FALSE if a resp_out object cannot be allocated. When this function
returns FALSE, a program can continue with other processing, if necessary,

rather than waiting for a free message buffer.

See Chapter 6,

How Devices Communicate Using Application Messages,

in the

Neuron C Programmer's Guide

for more information about application messages.

Syntax

boolean resp_alloc (void);

Example

when (...)
{

if (resp_alloc()) {

// OK. Build and send message

...
}
}

resp_cancel( )

Built-in Function

The resp_cancel( ) built-in function cancels the response being built and frees the
associated resp_out object, allowing another response to be constructed.
If a response is constructed but not sent before the critical section (for example, a

task) is exited, the response is automatically cancelled. See Chapter 6,

How

Devices Communicate Using Application Messages,

of the

Neuron C

Programmer's Guide

for more information.

Syntax

void

resp_cancel (void);

Example

void f(void)
{

if (resp_alloc()) {

...

Advertising