Multithreading is more then just creating threads

By | March 15, 2008

I’ve spent some time recently to update the Jong-Soft libraries to support multithreading a bit better. I’ve had this request from a developer that used the library. He loved to use more then one thread and still be able to use some of the key features like ErrorHandling.

To bo honest I can’t blame him. I just hadn’t kept it in mind when I wrote my error handling classes. So the problem was simple. If a new function call was added in multithreading I could not guarantee that the logging would be in the right order. Let me explain by an example:

Thread one calls a function:                                  – error handler creates a function node 1
Thread one creates a thread:                               – nothing happend in the error handler
Thread one calls a function:                                  – error handler creates a function node 2
Thread two calls a function:                                  – error handler creates a function node 3
Thread one leaves function:                                  – error handler closes function node 3

Hey that ain’t right. Why is function node 3 closed ;). See the problem, well that is what I am trying to solve right now. Of course there are more problems with multi threading, but this is the one causing the most headaches right know. Especially since I know need to keep track of every started thread to add nodes to the right parent node.

There are probable some more problems I will need to fix in the time to come related to the multi threading setups. I’ll keep you up to date with some of the advances I’ve made with the multi threading solutions.

Leave a Reply