WSSetThreadSafeLinksParameter()
This feature is not supported on the Wolfram Cloud.

long WSSetThreadSafeLinksParameter(WSEnvironmentParameter p)
enables thread safety for all links created by the WSTP environment object initialized with p.

DetailsDetails

  • By default, WSTP link objects are not thread-safe. To enable thread-safety for all link objects produced by a WSTP environment object by default, set the thread-safety parameter with WSSetThreadSafeLinksParameter().
  • Thread-safety for link objects means that multiple threads can call WSTP API functions on the same link object simultaneously.
  • p must have been created using the WSNewParameters() WSTP API function.
  • WSSetThreadSafeLinksParameter() returns error codes using the standard error values as returned by WSError().
  • WSSetThreadSafeLinksParameter() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

int main()
{
    WSEnvironmentParameter ep;
    WSENV env;
    long apiResult;
    
    ep = WSNewParameters(WSREVISION, WSAPIREVISION);
    if(ep == (WSEnvironmentParameter)0)
    { /* Unable to create the WSEnvironmentParameter object. */ }

    apiResult = WSSetThreadSafeLinksParameter(ep);
    if(apiResult != WSEOK)
    { /* Failed to set thread-safe links parameter */ }

    env = WSInitialize(ep);
    if(env == (WSENV)0)
    { /* Failed to initialize WSTP environment object */ }

    WSReleaseParameters(ep);

    /* ... */

    WSDeinitialize(env);

    return 0;
}