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 clean more mercury'ish methods for implementation), however the performance is dismal in this case. I think it may have somethign 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.