User`s guide

Cray XMT Programming Environment Users Guide
void LucServerOnlyUsageModel(void)
{
// First create a communication endpoint. This is used to accept calls from
// remote clients.
LucEndpoint *server = luc_allocate_endpoint(LUC_SERVER_ONLY);
// These values correspond to values used by clients of this service.
luc_service_type_t serviceType = LUC_ST_QueryEngine;
int serviceFunctionIndex = QUERY_ENGINE_ALIVE_FCTN_ID;
// The registration routine simply records the desired function in a
// table so that future client requests know which function to fire.
lucError = server->registerRemoteCall(serviceType,
serviceFunctionIndex,
ServerQueryEngineAliveFunction);
// The LucEndpoint object must be started before it can accept remote
// function call requests.
// This example creates two server worker threads; one to do main processing
// and one to execute the ServerQueryEngineAliveFunction when it's called.
uint_t totalThreadCount = 2;
// This server doesn't need a specific Portals PID value.
uint_t requestedPid = PTL_PID_ANY;
lucError = server->startService(totalThreadCount,
requestedPid);
// If the server wants to report its endpoint id, via printf or socket-based
// communication to some other application, it can get its endpoint ID
// with the following function.
luc_endpoint_id_t myEndpointId = server->getMyEndpointId();
// A proper service can go do other work here, wait for a termination
// signal, or exit this thread (as long as the server object isn't
// destroyed).
// The endpoint object will accept and remote function requests
// until stopped at some later time with stopService.
lucError = server->stopService();
delete server;
return;
}
5.5 LUC Client/Server Example
This example implements a server-side sum of values provided by the client, with
the sum returned to the client. The program should be run once using the following
command to start the server:
% exluc -s
60 S247920