Ian Bicking <[EMAIL PROTECTED]> writes: > This recipe might be of use: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496746 > > I don't believe it is threadsafe, but I'm not sure. I think it needs to > run the code in the main thread, then puts an alarm in a subthread that > interrupts the main thread if it takes too long. I don't think other > threads can be interrupted that way.
That is a very good find Ian. It is very similar to what I am suggesting. In my worker threads we used event object for signaling. The main thread joins the worker thread to set the event which worker thread then detects it is to end. Using that mechanism you would avoid the issue of how to kill the thread since the thread ends it self based on the event object allowing it to break out of the loop. Since the recipe has the parsing logic already in place it shouldn't take much tweaking to scan for loop keywords and insert code. I would log those code fragments so that if the parsing logic misses a loop, you could examine the code fragment and further refine the parsing logic. Eventually it would become bullet proof. Using this mechanism you can enforce the necessary logic to avoid infinite loops. Oliver to solve your issue it is going to take some work given the nature of your system that you have described. With that recipe you have a lot of the work already done. If you are not sure how to setup worker threads and use event objects I could post a code fragment here. For that matter I think ASPN already has recipes for those concepts. All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss