Next: UserDatabase
Up: Server Classes
Previous: Remote Administration Interfaces
  Contents
The server employs a main thread which listens for incoming
connections. Once established, each connection runs
concurrently in its own thread. Therefore, shared data objects such as
UserDatabase and ServerMeasure require some concurrency control in
order to maintain a consistent state.
SynchronisedObject is an abstract class that wraps up the pthread
mutex handling functions so an object that needs to be synchronised
can extend the class and then lock and unlock the mutex just by
calling the lock() and unlock() methods (see
appendix B.1).
The LinuxThreads implementation supports three types of mutex:
fast; recursive and error
checking[GNU99]. As using pthreads and mutexes were new to the
author, it was decided that an error checking mutex would be the most
helpful way of avoiding hard to track down bugs, although it would
incur a slight performance penalty over fast mutexes. Therefore,
abstracting away the function calls inside this class offered two
advantages:
- The clunky C-like error checking code was hidden in the
implementation details of the class and replaced by throwing an
exception.
- The implementation could be easily altered to use ``fast'' mutexes once
the code was working properly, without changing any other code
except this class.
Next: UserDatabase
Up: Server Classes
Previous: Remote Administration Interfaces
  Contents
Nathan Dimmock
2001-06-20