fix compilation warnings.
* Split locking functions into own files.
* Add test-data generator.