OpenersNotesSection(Spacer1)Details

Use MLWaitForLinkActivity() 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 MLWaitForLinkActivity() (or the related function (NonWLLink[MLWaitForLinkActivityWithCallback(), paclet:/ref/c/MLWaitForLinkActivityWithCallback])) when needing to wait for link activity on a link that is enabled for logging().

MLWaitForLinkActivity() returns MLWAITERROR in the event of an error and MLWAITSUCCESS if the function succeeds.

MLWaitForLinkActivity() is declared in the MathLink header file (RefLink[mathlink.h, paclet:/ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* A function for waiting on link activity */

void f(MLINK l)
{
	switch(MLWaitForLinkActivity(l))
	{
		case MLWAITERROR:
			/* Handle the error */
			break;
		case MLWAITSUCCESS:
		default:
			/* Do something else */
	}
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLWaitForLinkActivityWithCallback(), paclet:/ref/c/MLWaitForLinkActivityWithCallback])  ▪  (NonWLLink[MLLogStreamToFile(), paclet:/ref/c/MLLogStreamToFile])}})}})