Your assignment is to extend the original version to handle multiple clients by making by converting the server to use multiple threads, one for each client.
The code should be essentially as simple as the original sequential version and as fair as the complicated 'select' version.
Some synchronization of access to the database is necessary, but this will turn out not to add substantially to the code bloat if done properly.
Thread Creation
To create a thread call pthread_create:
pthread_create(&thread, // thread id 0, // ptr to thread attributes (e.g. stack size?) server, // start function argument); // ptr to arguments for start function
Return type of pthread_create is int (0 means success)
0 (or NULL) for the thread attributes gets the default attributes, which are usually acceptable. E.g., the default stack size for the thread is usually satisfactory.
server must be a function that returns void * and its declared argument must also be of type void *