The exfds.c program demonstrates how an Open Server application can service external file descriptors without blocking the entire Open Server process. This program performs a number of tasks:
Verifies that the current platform supports srv_poll, using the srv_capability routine
Opens two UNIX pipes
Spawns two service threads, srv_poll and srv_stop, using the srv_spawn routine
The two service threads implement a simple command/response protocol by writing messages on the UNIX pipes. srv_poll is used to allow Open Server to reschedule the service thread while waiting for a message. Information is written to srv.log to monitor the progress. The Open Server performs the command/response protocol the number of times specified in the source code and then queues a SRV_STOP event.
This sample does not require a client application. Check the srv.log file for messages to determine if it has started correctly.