blob: 0d03aa02a035cbae222b0535fc8163e70d028052 [file] [log] [blame]
.\"Copyright 2008-2010 IBM Corp.
.TH SCI_Poll 3 "Dec 4, 2009" "1.0.0" "SCI"
.SH NAME
\fBSCI_Poll\fP \- Check for arriving messages in polling mode
.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <sci.h>
int SCI_Poll(int \fItimeout\fP)
.SH INPUT PARAMETERS
.ft R
.TP 1i
timeout
Timeout if no message arrives in \fItimeout\fP milliseconds, <0 means no timeout (IN).
.SH DESCRIPTION
.ft R
This subroutine is used to check for arriving messages in polling mode. If a new message
is arrived, user-registered handler in \fIsci_info_t\fP will be called to handle the message,
otherwise a timeout will occur after \fItimeout\fP milliseconds elapsed.
.sp
If \fItimeout\fP is set to a negative value, no timeout will occur, and \fBSCI_Poll\fP can only
return when a new message arrived or errors occurred.
.sp
For more information, please refer to SCI's online documents.
.SH EXAMPLE
.ft R
.nf
{
int pollFd, extFd, maxFd;
fd_set fdSet;
SCI_Query(POLLING_FD, &pollFd);
...
FD_ZERO(&fdSet);
FD_SET(pollFd, &fdSet);
FD_SET(extFd, &fdSet);
maxFd = (pollFd > extFd) ? pollFd : extFd;
select(maxFd+1, &fdSet, 0, 0, NULL);
if (FD_ISSET(pollFd, &fdSet)) {
SCI_Poll(-1);
}
if (FD_ISSET(extFd, &fdSet)) {
...
}
}
.fi
.SH ERRORS
.ft R
All SCI routines return an error value.
.sp
.TP 1i
SCI_ERR_UNINTIALIZED
Uninitialized SCI execution environment
.TP 1i
SCI_ERR_INVALID_CALLER
Can only be called in the front end
.TP 1i
SCI_ERR_MODE
Can only be used in polling mode
.TP 1i
SCI_ERR_POLL_INVALID
Invalid polling calls
.TP 1i
SCI_ERR_POLL_TIMEOUT
A polling timeout occurs after \fItimeout\fP milliseconds elapsed
.SH SEE ALSO
.ft R
.nf
\fBSCI_Bcast\fP(3)
\fBSCI_Upload\fP(3)