• Home
  • Raw
  • Download

Lines Matching +full:wait +full:- +full:for +full:- +full:processing

1 // SPDX-License-Identifier: Apache-2.0
2 // ----------------------------------------------------------------------------
3 // Copyright 2011-2024 Arm Limited
9 // http://www.apache.org/licenses/LICENSE-2.0
14 // License for the specific language governing permissions and limitations
16 // ----------------------------------------------------------------------------
19 * @brief Functions and data declarations for the outer context.
21 * The outer context includes thread-pool management, which is slower to
41 * @brief A simple counter-based manager for parallel task execution.
43 * The task processing execution consists of:
45 * * A single-threaded init stage.
46 * * A multi-threaded processing stage.
47 * * A condition variable so threads can wait for processing completion.
52 * The processing stage uses dynamic dispatch to assign task tickets to threads on an on-demand
54 * processing complexity. The task queue and the task tickets are just counters; the caller must map
55 * these integers to an actual processing partition in a specific problem domain.
57 * The exit wait condition is needed to ensure processing has finished before a worker thread can
58 * progress to the next stage of the pipeline. Specifically a worker may exit the processing stage
59 * because there are no new tasks to assign to it while other worker threads are still processing.
60 * Calling @c wait() will ensure that all other worker have finished before the thread can proceed.
64 * // --------- From single-threaded code ---------
67 * manager->reset()
69 * // --------- From multi-threaded code ---------
72 * manager->init(<lambda>)
78 * uint base_index = manager->get_tasks(<granule>, task_count);
83 * // Run the user task processing code for N tasks here
87 * manager->complete_tasks(task_count);
91 * // Wait for all threads to complete tasks before progressing
92 * manager->wait()
95 * manager->term(<lambda>)
100 /** @brief Lock used for critical section and condition synchronization. */
109 /** @brief Condition variable for tracking stage processing completion. */
124 /** @brief Lock used for callback synchronization. */
141 * @brief Reset the tracker for a new processing batch.
143 * This must be called from single-threaded code before starting the multi-threaded processing
160 * This can be called from multi-threaded code. The first thread to hit this will process the
161 * initialization. Other threads will block and wait for it to complete.
179 * This can be called from multi-threaded code. The first thread to hit this will process the
180 * initialization. Other threads will block and wait for it to complete.
182 * @param task_count Total number of tasks needing processing.
183 * @param callback Function pointer for progress status callbacks.
203 * Assign up to @c granule tasks to the caller for processing.
219 count = astc::min(m_task_count - base, granule); in get_task_assignment()
226 * Mark @c count tasks as complete. This will notify all threads blocked on @c wait() if this
227 * completes the processing of the stage.
234 // update here and the wait() for other threads in complete_task_assignment()
261 // Initial lockless test - have we progressed enough to emit? in complete_task_assignment()
265 bool report_test = (this_value - local_last_value) > m_callback_min_diff; in complete_task_assignment()
271 bool report_retest = (this_value - m_callback_last_value) > m_callback_min_diff; in complete_task_assignment()
282 * @brief Wait for stage processing to complete.
284 void wait() in wait() function
287 m_complete.wait(lck, [this]{ return m_done_count == m_task_count; }); in wait()
293 * This can be called from multi-threaded code. The first thread to hit this will process the
294 * work pool termination. Caller must have called @c wait() prior to calling this function to
295 * ensure that processing is complete.
319 /** @brief The parallel manager for averages computation. */
322 /** @brief The parallel manager for compression. */
326 /** @brief The parallel manager for decompression. */