Another major revision; basic thread safe interface is working with demo

The thread demo is finally relevant and there are some significant modifications to the API that lend this power. I have tried at least two other methods (that use cleaner and more mercury'ish methods for implementation), however the performance is dismal in this case. I think it may have something to do with interaction with the GC. Nonetheless, this re-implementation performs extremely well -- it just looks ugly. Either way, it looks like things are working smoothly. Test it when you get the chance! Thanks.