Thread safety

The pull request contains the fix to use safely the TouchXML with multithreading.