• Advertisement
Sign in to follow this  
  • entries
    570
  • comments
    2427
  • views
    216658

Untitled

Sign in to follow this  

56 views

I decided to go off onto a wild coding tangent today. I whipped up a task scheduling system where you pass it function pointers and it runs them after a desired time/at specific intervals. They're run by passing them to a thread pool, which I also implemented. Again, the whole thing is (almost) API independant. You can easily swap out the components for threads, mutexes, etc by changing template parameters. Right now I've got them all implemented with the win32 API, but I might bring myself to write a set of SDL classes too for all you non-Windows people out there (LOL).

Right now the system assumes that there are no dependancies between the threads; ie, its not quite thread-safe yet. I plan to put in a way to mark one task as a dependancy of another, so that the scheduler can guarentee one will be finished before the other each pass.

So yeah... didn't get any work done on anything today. Again >_<
Sign in to follow this  


2 Comments


Recommended Comments

What's wrong is that it wasn't in his book, Modern C++ Design aside from a brief chat in the appendix :P

I'll have to take a closer look at it. Thanks for the heads up :D

EDIT: Actually, I kind of want to design a mechanism that doesn't rely on mutexes. I'm still working on it, and I want to test the threadpool prototype (as well as fix some existing dependancies by refactoring) first. Should provide some diversion, since the GUI stuff is boring right now :P

EDIT2: And don't rail me with Dijkstra yet :(

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement