6.09.2012

I'm so dumb

Naahh, goddammit I knew there are way better solution to my threading needs than the stuff I did before. You know what? Fuck the threadmanager thing, fuck global events cause it's so much easier and effective if just limit events to single threads and let one thread be the global event manager with exactly the same interface as everyone else! I would bite my own ear out of sheer frustration if I could. I started a very simple redesign based on message passing and multiple message boxes in combination with per-thread events. I know it's not as random to control as the previous setup, but it's way simpler and less error-prone in concept. I'll rely on this setup to rewrite everything until my guts leak out. Bah, what a disgusting realization all in all! However, this is food for my bachelor work as I knew there'd be a more simple setup if I'd only limit myself to single threads with no manager. Global events and thus pauses can be done by registering all threads that want to pause within a manager thread, just like the manager. Or just by creating n events that'll be locked in the beginning and used by the client threads to do waiting... And the message box fulfills my idea of tasks you can pass, though you'll have to create to associated events on you own by deriving the message structure. You can also pass messages between threads and share, store and reuse them. But if you run out of messages, you should make sure that you return incoming messages to it's sender or just pingpong them between threads. This is really more clean than my old version and you don't need to watchout for deadlocks while messages or so as message boxes of threads will stay alive even if the threads is paused or dead. Though this does not apply to events, these are a potential deadlock of course if don't watch out. Yeah, that's it for now. Can't believe how stupid I was to fiddle with alle this uber-complicated syncing stuff. I mean I'm more experienced now and the new design is better than before. And I can create sub types of threads and so on and so on. Comes in handy during my bachelor time cause the more non-working concepts you know (with own faulty implementation) makes more confident with the overall topic and theory.

No comments: