mpiControlEventServiceStart
Declaration
MPI_RESULT mpiControlEventServiceStart(MPIControl control, MPIThreadPriority priority, MPIWait sleep, const MPIControlEventServiceErrorConfig *errorConfig);
Required Header: stdmpi.h
Change History: Added in 04.00.
Description
mpiControlEventServiceStart sets the running state of the Service object (service).
control | The service object |
---|---|
Priority | The priority of the event service thread. A value of MPIThreadPriorityDEFAULT sets the event services thread priority equal to the executing thread’s priority. A value of MPIThreadPriorityHIGHEST sets the event services thread priority to the highest possible priority. A value of MPIThreadPriorityHIGHEST sets the event. |
sleep | The time in milliseconds the service thread sleeps between checking the controller for events. If sleep is MPIWaitFOREVER, then the service thread uses controller interrupts to determine when events have occurred on the controller and need to be distributed. |
errorConfig | A pointer to the event service configuration. The configuration includes an error handler and a error threshold. If errorConfig is NULL, no error handler will be installed and the error threshold will be set to zero. This means the event service thread will silently exit on the first error it encounters. Note: Setting errorConfig to NULL is NOT recommended since it will disable the ability to catch and log errors that occur inside the event service thread. |
Sample Code
/* Event service error handler - logs error data to 'logFile' */ MPI_BOOL MPI_DECL2 myEventServiceErrorHandler(MPIControlEventServiceErrorParams *params) { fprintf(logFile, "Event service thread error occurred:\n" " Error Count = %d Error = 0x%x (%s)\n", params->errorCount, params->message, mpiMessage(params->message, NULL)); return FALSE; } /* Create service thread */ void startEventService(MPIControl control) { MPIControlEventServiceErrorConfig serviceErrorConfig; serviceErrorConfig.errorHandler = NULL; serviceErrorConfig.errorThreshold = 1; returnValue = mpiControlEventServiceStart(*control, MPIThreadPriorityHIGHEST, MPIWaitFOREVER, /* FOREVER => enable interrupts */ &serviceErrorConfig); }
See Also
Event Service | MPIControlEventServiceErrorConfig | MPIThreadPriority | MPIThreadPriorityDEFAULT | MPIThreadPriorityHIGHEST | MPIWait