Allows the calling thread to check communication progress.
Availability Library (liblapi_r.a)
#include <lapi.h>
int LAPI_Msgpoll(hndl, cnt, info)
lapi_handle_t hndl;
uint cnt;
lapi_msg_info_t *info;
typedef struct {
lapi_msg_state_t status; /* Message status returned from LAPI_Msgpoll */
ulong reserve[10]; /* Reserved */
} lapi_msg_info_t;
include 'lapif.h'
LAPI_MSGPOLL(hndl, cnt, info, ierror)
INTEGER hndl
INTEGER cnt
TYPE (LAPI_MSG_STATE_T) :: info
INTEGER ierror
Type of call: local progress monitor (blocking)
The LAPI_Msgpoll subroutine allows the calling thread to check communication progress. With this subroutine, LAPI provides a means of running the dispatcher several times until either progress is made or a specified maximum number of dispatcher loops have executed. Here, progress is defined as the completion of either a message send operation or a message receive operation.
LAPI_Msgpoll is intended to be used when interrupts are turned off. If the user has not explicitly turned interrupts off, LAPI temporarily disables interrupt mode while in this subroutine because the dispatcher is called, which will process any pending receive operations. If the LAPI dispatcher loops for the specified maximum number of times, the call returns. If progress is made before the maximum count, the call will return immediately. In either case, LAPI will report status through a data structure that is passed by reference.
{
lapi_msg_info_t msg_info;
int cnt = 1000;
.
.
.
LAPI_Msgpoll(hndl, cnt, &msg_info);
if ( msg_info.status & LAPI_BOTH_COMPLETE ) {
/* both a message receive and a message send have been completed */
} else if ( msg_info.status & LAPI_RECV_COMPLETE ) {
/* just a message receive has been completed */
} else if ( msg_info.status & LAPI_SEND_COMPLETE ) {
/* just a message send has been completed */
} else {
/* cnt loops and no progress */
}
}