Vadim Lebedev a écrit :
Second, even if we have one thread per timer, why do you need to create it
in the constructor? and then stop/restart it in the start(..) method?


I often find it easier to maintain if members of a class are always allocated, rather than created and deleted on demand. You also need to know that instantiating a PrivateThread won't create any thread. The real thread will actually be created in the start() method, which instantiate a boost::thread().

Ah, i see,

but in that case why don't use embedded object and avoid new/delete stuff alltogether?

It avoids moving the code of the PrivateThread class in the .h file. This is some kind of Pimpl idiom. It allows heavy changes to the PrivateThread class without touching the Timer.h file. This saves quite a lot of recompilation.

Aurélien
_______________________________________________
Wengophone-devel mailing list
[email protected]
http://dev.openwengo.com/mailman/listinfo/wengophone-devel

Reply via email to