LAPI_Waitcntr Subroutine

Purpose

Waits until a specified counter reaches the value specified.

Library

Availability Library (liblapi_r.a)

C Syntax

#include <lapi.h>
 
int LAPI_Waitcntr(hndl, cntr, val, cur_cntr_val)
lapi_handle_t  hndl;
lapi_cntr_t   *cntr;
int            val;
int           *cur_cntr_val;

FORTRAN Syntax

include 'lapif.h'
 
LAPI_WAITCNTR(hndl, cntr, val, cur_cntr_val, ierror)
INTEGER hndl
TYPE (LAPI_CNTR_T) :: cntr
INTEGER val
INTEGER cur_cntr_val
INTEGER ierror

Description

Type of call: local progress monitor (blocking)

This subroutine waits until cntr reaches or exceeds the specified val. Once cntr reaches val, cntr is decremented by the value of val. In this case, "decremented" is used (as opposed to "set to zero") because cntr could have contained a value that was greater than the specified val when the call was made. This call may or may not check for message arrivals over the LAPI context hndl. The cur_cntr_val variable is set to the current counter value.

Parameters

INPUT
hndl
Specifies the LAPI handle.
val
Specifies the value the counter needs to reach.
INPUT/OUTPUT
cntr
Specifies the counter structure (in FORTRAN) to be waited on or its address (in C). The value of this parameter cannot be NULL (in C) or LAPI_ADDR_NULL (in FORTRAN).
OUTPUT
cur_cntr_val
Specifies the integer value of the current counter. This value can be NULL (in C) or LAPI_ADDR_NULL (in FORTRAN).
ierror
Specifies a FORTRAN return code. This is always the last parameter.

Restrictions

LAPI statistics are not reported for shared memory communication and data transfer, or for messages that a task sends to itself.

C Examples

To wait on a counter to reach a specified value:
{
 
      int          val;
      int          cur_cntr_val;
      lapi_cntr_t  some_cntr;
      .
      .
      .
      LAPI_Waitcntr(hndl, &some_cntr, val, &cur_cntr_val);
      /* Upon return, some_cntr has reached val */

} 

Return Values

LAPI_SUCCESS
Indicates that the function call completed successfully.
LAPI_ERR_CNTR_NULL
Indicates that the cntr pointer is NULL (in C) or that the value of cntr is LAPI_ADDR_NULL (in FORTRAN).
LAPI_ERR_HNDL_INVALID
Indicates that the hndl passed in is not valid (not initialized or in terminated state).

Location

/usr/lib/liblapi_r.a