Implementation of C++0x's "future" syntax

Kevin Bealer kevinbealer at gmail.com
Tue Jan 16 01:55:41 PST 2007


== Quote from Daniel Keep (daniel.keep+lists at gmail.com)'s article
> Kevin Bealer wrote:
> > Dang, you beat me to it.
> Yesss; finally, I beat someone to something :3
> > I've been working on this for couple of weeks myself.  I have an implementation I
> > was thinking of putting up on dsource or somewhere in the next day or two.  Its a
> > bit different though, I wrote a thread pool and some other stuff for it.  I'll
> > mention something here when I get it posted.
> >
> > Kevin
> Sounds good.  Mine was just a quick little proof of concept.  I think
> that for something like this to be really efficient, it does need a
> thread pool.  Honestly, I've been waiting to see what Tango contains
> before I go and write my own :P
> Since I'm going to have to move over to heap allocation (bangs head
> again), I was wondering: do you use stack allocation, or a custom
> allocator for small objects?
> 	-- Daniel

I had not gotten into the efficiency angle (yet).  Right now, the user calls "new"
for the 'future' object and it calls new for another 'task' object that represents
the work itself.  These two classes could be merged to reduce calls to new().  I
hadn't thought of this as a critical area since I was thinking that this would be
for larger tasks like parsing an input file, sorting large arrays, and so on.

I didn't look at your code too deeply but I think your design has some things like
capturing the inputs for the delegate, and handling void delegates that mine did
not include yet.

I have a bug that I want to fix, plus I need to ask my company before releasing
the code, but I'm told thats just a formality as long as it doesn't relate to work.

Of course there are additional features to consider for later on.

Kevin



More information about the Digitalmars-d-announce mailing list