@@ -13,8 +13,8 @@ namespace dispatch_queue {
1313class dispatch_queue {
1414public:
1515 /* *
16- * Create a synchronous dispatch queue.
17- * In synchronous mode, tasks are executed immediately when calling `dispatch`.
16+ * Create an immediate dispatch queue.
17+ * In immediate mode, tasks are executed immediately when calling `dispatch`.
1818 */
1919 dispatch_queue ();
2020
@@ -28,12 +28,12 @@ class dispatch_queue {
2828 * Initializes dispatch queue with `thread_count` background threads and a worker initialization functor.
2929 *
3030 * @param thread_count Number of background threads used to run tasks.
31- * If 0, the dispatch queue is created in synchronous mode.
31+ * If 0, the dispatch queue is created in immediate mode.
3232 * If 1, tasks will run serially in background, one at a time, without any concurrency.
3333 * Otherwise, `thread_count` threads will be created and tasks may run concurrently.
3434 * Pass a negative number to use the default value of `std::thread::hardware_concurrency()` threads.
3535 * @param worker_init Functor called inside worker threads for initialization, receiving as argument the worker index.
36- * May be used to set the thread name, for example.
36+ * May be used to set the thread name or initialize thread local variables , for example.
3737 */
3838 template <typename Fn>
3939 dispatch_queue (int thread_count, Fn&& worker_init) {
@@ -55,7 +55,7 @@ class dispatch_queue {
5555
5656 /* *
5757 * Dispatch a task that calls `f` with forwarded arguments `args`.
58- * If the dispatch queue is in synchronous mode, the task is processed immediately in the calling thread.
58+ * If the dispatch queue is in immediate mode, the task is processed immediately in the calling thread.
5959 * @param f Functor to be executed
6060 * @param args Arguments forwarded to `f`
6161 * @returns Future for getting `f` result.
@@ -71,6 +71,7 @@ class dispatch_queue {
7171 * @param f Functor to be executed
7272 * @param args Arguments forwarded to `f`
7373 * @returns Future for getting `f` result.
74+ * @see main_loop
7475 */
7576 template <typename F, typename ... Args, typename Ret = detail::function_result<F, Args...>>
7677 task<Ret> dispatch_main (F&& f, Args&&... args) {
@@ -84,7 +85,7 @@ class dispatch_queue {
8485
8586 /* *
8687 * Number of threads used for processing tasks.
87- * This will be 0 on synchronous mode.
88+ * This will be 0 in immediate mode.
8889 */
8990 int thread_count () const ;
9091
@@ -106,7 +107,7 @@ class dispatch_queue {
106107
107108 /* *
108109 * Invoke main loop tasks dispatched using `dispatch_main`.
109- * This should be called in you application main loop.
110+ * This should be called in your application's main loop.
110111 */
111112 void main_loop ();
112113
@@ -118,7 +119,7 @@ class dispatch_queue {
118119 /* *
119120 * Wait until all pending tasks finish processing.
120121 * Blocks until specified `timeout_duration` has elapsed or all queued tasks complete, whichever comes first.
121- * @returns `false ` if the timeout has expired , otherwise `true `.
122+ * @returns `true ` if all tasks finished processing , otherwise `false `.
122123 */
123124 template <class Rep , class Period >
124125 bool wait_for (const std::chrono::duration<Rep, Period>& timeout_duration) {
@@ -133,7 +134,7 @@ class dispatch_queue {
133134 /* *
134135 * Wait until all pending tasks finish processing.
135136 * Blocks until the specified `timeout_time` has been reached or all queued tasks complete, whichever comes first.
136- * @returns `false ` if the timeout has expired , otherwise `true `.
137+ * @returns `true ` if all tasks finished processing , otherwise `false `.
137138 */
138139 template <class Clock , class Duration >
139140 bool wait_until (const std::chrono::time_point<Clock, Duration>& timeout_time) {
@@ -146,8 +147,8 @@ class dispatch_queue {
146147 }
147148
148149 /* *
149- * Cancel pending tasks, wait and release the used Threads .
150- * The queue now runs in synchronous mode.
150+ * Cancel pending tasks, wait and release the used threads .
151+ * The queue now runs in immediate mode.
151152 * It is safe to call this more than once.
152153 */
153154 void shutdown ();
0 commit comments