diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-15 19:55:13 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-15 19:55:13 +0200 |
commit | 80409986244b595a33cce03b975698bf6f836a4a (patch) | |
tree | 2c97290c47d1928ae03b62bed6c356abe32f5512 /tpool | |
parent | 37f1ab2323cbf6671e43c6449249f06f949f9f03 (diff) | |
download | mariadb-git-80409986244b595a33cce03b975698bf6f836a4a.tar.gz |
MDEV-16264: Fix some white space
Diffstat (limited to 'tpool')
-rw-r--r-- | tpool/aio_simulated.cc | 8 | ||||
-rw-r--r-- | tpool/tpool.h | 2 | ||||
-rw-r--r-- | tpool/tpool_generic.cc | 34 | ||||
-rw-r--r-- | tpool/tpool_structs.h | 33 | ||||
-rw-r--r-- | tpool/tpool_win.cc | 2 |
5 files changed, 31 insertions, 48 deletions
diff --git a/tpool/aio_simulated.cc b/tpool/aio_simulated.cc index 41c4897336d..7deaf745aa2 100644 --- a/tpool/aio_simulated.cc +++ b/tpool/aio_simulated.cc @@ -27,11 +27,11 @@ namespace tpool /* In order to be able to execute synchronous IO even on file opened - with FILE_FLAG_OVERLAPPED, and to bypass to completion port, - we use valid event handle for the hEvent member of the OVERLAPPED structure, + with FILE_FLAG_OVERLAPPED, and to bypass to completion port, + we use valid event handle for the hEvent member of the OVERLAPPED structure, with its low-order bit set. - ´See MSDN docs for GetQueuedCompletionStatus() for description of this trick. + See MSDN docs for GetQueuedCompletionStatus() for description of this trick. */ static DWORD fls_sync_io= FLS_OUT_OF_INDEXES; HANDLE win_get_syncio_event() @@ -177,4 +177,4 @@ aio *create_simulated_aio(thread_pool *tp) return new simulated_aio(tp); } -} // namespace tpool
\ No newline at end of file +} // namespace tpool diff --git a/tpool/tpool.h b/tpool/tpool.h index 7b504c5ef57..ad63e25bdd7 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -53,7 +53,7 @@ namespace tpool typedef void (*callback_func)(void *); class task; -/* A class that can be used e.g for +/** A class that can be used e.g. for restricting concurrency for specific class of tasks. */ class task_group diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc index 2a4971cd555..4416dcadc7e 100644 --- a/tpool/tpool_generic.cc +++ b/tpool/tpool_generic.cc @@ -54,7 +54,7 @@ namespace tpool - The task queue. This queue is populated by submit() - Worker that execute the work items. - Timer thread that takes care of pool health - + The task queue is populated by submit() method. on submit(), a worker thread can be woken, or created to execute tasks. @@ -162,26 +162,26 @@ class thread_pool_generic : public thread_pool /** The task queue */ circular_queue<task*> m_task_queue; - /* List of standby (idle) workers.*/ + /** List of standby (idle) workers */ doubly_linked_list<worker_data> m_standby_threads; - /** List of threads that are executing tasks. */ + /** List of threads that are executing tasks */ doubly_linked_list<worker_data> m_active_threads; /* Mutex that protects the whole struct, most importantly - the standby threads list, and task queue. */ + the standby threads list, and task queue */ std::mutex m_mtx; - /** Timeout after which idle worker shuts down.*/ + /** Timeout after which idle worker shuts down */ std::chrono::milliseconds m_thread_timeout; /** How often should timer wakeup.*/ std::chrono::milliseconds m_timer_interval; - /** Another condition variable, used in pool shutdown-*/ + /** Another condition variable, used in pool shutdown */ std::condition_variable m_cv_no_threads; - /** Condition variable for the timer thread. Signaled on shutdown.*/ + /** Condition variable for the timer thread. Signaled on shutdown. */ std::condition_variable m_cv_timer; /** Overall number of enqueues*/ @@ -189,16 +189,17 @@ class thread_pool_generic : public thread_pool /** Overall number of dequeued tasks. */ unsigned long long m_tasks_dequeued; - /**Statistic related, number of worker thread wakeups.*/ + /** Statistic related, number of worker thread wakeups */ int m_wakeups; - /** + /** Statistic related, number of spurious thread wakeups (i.e thread woke up, and the task queue is empty) */ int m_spurious_wakeups; - /** The desired concurrency. This number of workers should be actively executing.*/ + /** The desired concurrency. This number of workers should be + actively executing. */ unsigned int m_concurrency; /** True, if threadpool is being shutdown, false otherwise */ @@ -207,7 +208,7 @@ class thread_pool_generic : public thread_pool /** time point when timer last ran, used as a coarse clock. */ std::chrono::system_clock::time_point m_timestamp; - /** Number of long running tasks. The long running tasks are excluded when + /** Number of long running tasks. The long running tasks are excluded when adjusting concurrency */ int m_long_tasks_count; @@ -387,12 +388,11 @@ void thread_pool_generic::cancel_pending(task* t) /** Register worker in standby list, and wait to be woken. - @return - true - thread was woken - false - idle wait timeout exceeded (the current thread need to shutdown) + @retval true if thread was woken + @retval false idle wait timeout exceeded (the current thread must shutdown) */ bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk, - worker_data *thread_data) + worker_data *thread_data) { assert(m_task_queue.empty()); assert(!m_in_shutdown); @@ -441,7 +441,7 @@ bool thread_pool_generic::wait_for_tasks(std::unique_lock<std::mutex> &lk, bool thread_pool_generic::get_task(worker_data *thread_var, task **t) { std::unique_lock<std::mutex> lk(m_mtx); - + if (thread_var->is_long_task() && m_long_tasks_count) m_long_tasks_count--; @@ -577,7 +577,7 @@ void thread_pool_generic::maintainence() /* Heuristic used for thread creation throttling. Returns interval in milliseconds between thread creation - (depending on number of threads already in the pool, and + (depending on number of threads already in the pool, and desired concurrency level) */ static int throttling_interval_ms(size_t n_threads,size_t concurrency) diff --git a/tpool/tpool_structs.h b/tpool/tpool_structs.h index 6f47b3b3e40..9d55741036c 100644 --- a/tpool/tpool_structs.h +++ b/tpool/tpool_structs.h @@ -199,44 +199,27 @@ public: explicit iterator(size_t pos , circular_queue<T>* q) : m_pos(pos), m_queue(q) {} iterator& operator++() { - m_pos = (m_pos + 1) % m_queue->m_capacity; + m_pos= (m_pos + 1) % m_queue->m_capacity; return *this; } iterator operator++(int) { - iterator retval = *this; - ++(*this); + iterator retval= *this; + ++*this; return retval; } - bool operator==(iterator other) const - { - return m_pos == other.m_pos; - } - bool operator!=(iterator other) const - { - return !(*this == other); - } - T& operator*() const - { - return m_queue->m_buffer[m_pos]; - } + bool operator==(iterator other) const { return m_pos == other.m_pos; } + bool operator!=(iterator other) const { return !(*this == other); } + T& operator*() const { return m_queue->m_buffer[m_pos]; } }; - iterator begin() - { - return iterator(m_tail, this); - } - iterator end() - { - return iterator(m_head, this); - } + iterator begin() { return iterator(m_tail, this); } + iterator end() { return iterator(m_head, this); } private: size_t m_capacity; std::vector<T> m_buffer; size_t m_head; size_t m_tail; - - }; /* Doubly linked list. Intrusive, diff --git a/tpool/tpool_win.cc b/tpool/tpool_win.cc index 623b1b5577b..878d1af87c8 100644 --- a/tpool/tpool_win.cc +++ b/tpool/tpool_win.cc @@ -133,7 +133,7 @@ class thread_pool_win : public thread_pool class native_aio : public aio { thread_pool_win& m_pool; - + public: native_aio(thread_pool_win &pool, int max_io) : m_pool(pool) |