Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Sepples Timer Issue

Name: !a301wVUFtU 2009-01-30 0:29

So I have this timer class implementation mostly done with extensive use of boost, bind, etc. It's logically structured as having a default container and containers are available as a type so you can include them with any classes. When the container dies, so do the timers in it. There's a specific timer thread in this application that does all timer operations.

After coding for 5 hours straight, I've no fucking clue what I'm doing and this is likely the last barrier to my code working masterfully.

I have a class that's implemented as a singleton that manages all the resources necessary to it. When I pass resources for it to handle, it works perfectly fine if I only pass resources once before the timer ends. However, if I queue up numerous resources to handle, the timer causes a heap error upon the first completion of the timer which is supposed to spawn another timer that does the same thing.

The only thing I can think of is that I'm doing pointer-to-member functions wrong, but god damn if I can figure out how to do it.

Any anons happen to have advice or questions about things I should be elaborating on? Thanks in advance.

Name: Anonymous 2009-01-30 11:17

>>11
1) That's not good form.
And Singletons are? What is a Singleton but an OOP cludge of a global variable?

2) This project is much too complicated to have global variables sitting out there.
Now you have two problems.

3) How would I limit a global variable to a single instance? Yeah, exactly. You either have to create duplicate objects by using static so the compiler doesn't whine and bitch or you'd have to do it in a class, which I've done.
Anonymous types (inherited from C) are wonderful.

struct {
    int foo;
} bar;


I imagine you'll next bitch about "oh but then I can't pass it around and use it all over my code". No shit -- that'd introduce stamp coupling. Instead, keep that shit in the implementation details and put a function into a namespace like Bjarne intended.

Fuck you Sepples fag.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List