7 years, 5 months ago.

Proper way to attach function toTimeout?

HI,

currently I'm revising an old code I've written ... ages ago.

Within this code I used to attach Functions to Timeout objects like this:

class ToutCB { public: void doSomething(); };

Timeout tout; tout.attach_us(callback(&obj, &ToutCB::doSomething), 1000);

Thing is, when I do this, the current release points out, that this form of attachment is deprecated. Until now I never had problems with this.

But I "don't like" warnings in my Code. So, my question, what is the proper way to do this the 2016-way?

Greetings, Chris

Could you post the warning you got ?

Looking at the code you shouldn't get any if you use the form you've post.

posted by Vincent (pan-) Coubard 22 Nov 2016

Sorry for not updating this post. I already found the source of the warning.

It was an old referenced include which still used following call:

tout.attach(&fun, time);

Therefore, for my point of view everything is alright now. Still, thank you for your reply.

posted by Christian B*** 22 Nov 2016
Be the first to answer this question.