cvmfs/cvmfs — pull request #46 by reneme (2012-12-20 14:27:30+00:00)
Title: Additions to the Utility Toolset

* **SplitString()** now takes an additional (optional) argument, that defines how many chunks at most should be created when splitting a string

* A rather simple **StopWatch** class was added, allowing for time measurements using `gettimeofday()`

* Added a base class **DontCopy** that defines the copy-constructor and assignment operator to be `private`. Therefore classes that inherit from `DontCopy` will not be copyable.

* Added a simple **UniquePtr** template to manage pointer allocation in a RAII-fashion.

* Added some **concurrency gimmicks**:
* The base class **Lockable** implements a simple mutex lock mechanism. It allows inheriting classes to implement mutual exclusive access easily, through a common interface

* Using the RAII-style **LockGuard** template one can easily create scoped locks of objects that implement `Lockable` or using raw constructs such as `pthread_mutex_t` or `pthread_rwlock_t`

* The base class **Observable** allows inheriting classes to provide an asynchronous callback interface, to which arbitrary other classes can register callback functions or methods.

* Finally **ConcurrentWorkers** is a generic implementation of a _Producer/Consumer pattern_ that allows arbitrary _Workers_ to process _Jobs_ concurrently. **Workers** are classes that inherit from the `ConcurrentWorker` base class and define their _input_ as well as _output data_ and an interface to process a _Job_. Scheduling and synchronization is transparently done in the `ConcurrentWorkers` template. See the code documentation for further usage instructions.