The quest continues

I didn't have thaaaat much stuff to inline. Actually, only two headers cause the rest is numeric or algorithmic with generic typing. So I started to fix the bugs in my multithreading system again and BAM - there it was, the full miraculous deadlock problem along with a few very distinct bugs. All these problem don't occur when adding a few lines of user code to prevent too earlier tasker thread waiting. Weird. I mean I know the problem but now the pictures becomes even stranger because the code is so squeezed and atomic that I don't see ANY possibility that an error might come through. I know it worked before and it seems that it doesn't work when using itk_app as a convenience module. Sure would this imply that it's faullty, but I don't see any bad code there either! The bugs themselves occur in places they shouldn't occur and pop up randomly, setting pointers to 0x1 where they should and so on. I had a lengthy GDB session this morning and it jumps to smashed values from one break to another. All errors that happen seems to have a single source within the event code where I use a temporary local variable and pass it to another function. The point is that this object is still alive all the time and isn't used anymore in any way after triggering thread death. Even more, the local pointer inside the event using the externally local object should still have the same content, but it doesn't. Instead it's filled with 0x1's, so I have no idea why this is happening! One idea I had was that the item iteration is faulty. The only thing I fixed there was some wrong copy direction I didn't notice before, but this all doesn't explain why local content got changed without passing the local variables anywhere. So the only possibility left is a sneaky stack smash. I could try programming a new test file that doesn't use itk_app, but that will take some time - time I don't want to sacrifice right now. Also, it'd be one hell of a code block... I also thought about tackling a different approach of integrating an "I'm a dead" event taskers so that they'll be finished exactly the same way I finish them in my work-around, too. I don't like this approach as it should theoretically work without, too, but in the end it's the way around it. Will do some more tests and check what exactly works and what not. Seperating bugs from features.

No comments: