Multithread the compiler.

- Added rudimentary multithreading to the method scheduler.
- Added locks to compilation and trace listeners so that GUI oriented
exceptions do not occur.