WSWaitForLinkActivity (C Function)
int WSWaitForLinkActivity(WSLINK l)
does not return until the WSTP connection specified by l has data to read.
Details
- Use WSWaitForLinkActivity() on a background thread that needs to wait for data in order not to block any user interface or main threads of the application.
- Use WSWaitForLinkActivity() (or the related function WSWaitForLinkActivityWithCallback()) when needing to wait for link activity on a link that is enabled for logging().
- WSWaitForLinkActivity() returns WSWAITERROR in the event of an error and WSWAITSUCCESS if the function succeeds.
- WSWaitForLinkActivity() is declared in the WSTP header file wstp.h.
Examples
Basic Examples (1)
#include "wstp.h"
/* A function for waiting on link activity */
void f(WSLINK l)
{
switch(WSWaitForLinkActivity(l))
{
case WSWAITERROR:
/* Handle the error */
break;
case WSWAITSUCCESS:
default:
/* Do something else */
}
}