1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

Use reference parameters where possible

This commit is contained in:
Pavel Labath 2010-06-10 17:55:23 +02:00
parent 99fc975780
commit e5c9172de3
2 changed files with 4 additions and 4 deletions

View File

@ -59,7 +59,7 @@ typedef std::list<timed_thread_ptr> thread_list_t;
thread_list_t thread_list; thread_list_t thread_list;
/* create a timed thread (object creation only) */ /* create a timed thread (object creation only) */
timed_thread::timed_thread(const std::function<void(thread_handle &)> start_routine, unsigned timed_thread::timed_thread(const std::function<void(thread_handle &)> &start_routine, unsigned
int interval_usecs) : int interval_usecs) :
p_timed_thread(new _timed_thread), p_thread_handle(this), p_timed_thread(new _timed_thread), p_thread_handle(this),
interval_usecs(interval_usecs), running(false) interval_usecs(interval_usecs), running(false)

View File

@ -59,9 +59,9 @@ class thread_handle {
class timed_thread { class timed_thread {
public: public:
/* create a timed thread (object creation only) */ /* create a timed thread (object creation only) */
static timed_thread_ptr create(const std::function<void(thread_handle &)> start_routine, const unsigned int static timed_thread_ptr create(const std::function<void(thread_handle &)> &start_routine, const unsigned int
interval_usecs, bool register_for_destruction = true) { interval_usecs, bool register_for_destruction = true) {
timed_thread_ptr ptr(new timed_thread(std::cref(start_routine), interval_usecs)); timed_thread_ptr ptr(new timed_thread(start_routine, interval_usecs));
if (register_for_destruction) { if (register_for_destruction) {
register_(ptr); register_(ptr);
} }
@ -92,7 +92,7 @@ class timed_thread {
private: private:
/* create a timed thread (object creation only) */ /* create a timed thread (object creation only) */
timed_thread(const std::function<void(thread_handle &)> start_routine, unsigned int timed_thread(const std::function<void(thread_handle &)> &start_routine, unsigned int
interval_usecs); interval_usecs);
/* waits required interval (unless override_wait_time is non-zero) for /* waits required interval (unless override_wait_time is non-zero) for