From 267b8e1a5c322c87d9684638cc29c984c6d33e58 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 7 Sep 2020 15:57:12 +1000 Subject: Cleanup: spelling Also correct wrapped lines of example code in threads.cc. --- source/blender/blenlib/intern/threads.cc | 63 ++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'source/blender/blenlib/intern/threads.cc') diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index 002b78bec39..c206aa8d91f 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -65,49 +65,56 @@ extern pthread_key_t gomp_tls_key; static void *thread_tls_data; #endif -/* ********** basic thread control API ************ +/** + * Basic Thread Control API + * ======================== * * Many thread cases have an X amount of jobs, and only an Y amount of - * threads are useful (typically amount of cpus) + * threads are useful (typically amount of CPU's) * * This code can be used to start a maximum amount of 'thread slots', which * then can be filled in a loop with an idle timer. * * A sample loop can look like this (pseudo c); * - * ListBase lb; - * int maxthreads = 2; - * int cont = 1; + * \code{.c} * - * BLI_threadpool_init(&lb, do_something_func, maxthreads); + * ListBase lb; + * int max_threads = 2; + * int cont = 1; * - * while (cont) { - * if (BLI_available_threads(&lb) && !(escape loop event)) { - * // get new job (data pointer) - * // tag job 'processed - * BLI_threadpool_insert(&lb, job); - * } - * else PIL_sleep_ms(50); + * BLI_threadpool_init(&lb, do_something_func, max_threads); + * + * while (cont) { + * if (BLI_available_threads(&lb) && !(escape loop event)) { + * // get new job (data pointer) + * // tag job 'processed + * BLI_threadpool_insert(&lb, job); + * } + * else PIL_sleep_ms(50); * - * // find if a job is ready, this the do_something_func() should write in job somewhere - * cont = 0; - * for (go over all jobs) - * if (job is ready) { - * if (job was not removed) { - * BLI_threadpool_remove(&lb, job); * } - * } - * else cont = 1; * } - * // conditions to exit loop - * if (if escape loop event) { - * if (BLI_available_threadslots(&lb) == maxthreads) { - * break; - * } + * // Find if a job is ready, this the do_something_func() should write in job somewhere. + * cont = 0; + * for (go over all jobs) + * if (job is ready) { + * if (job was not removed) { + * BLI_threadpool_remove(&lb, job); * } + * } + * else cont = 1; * } + * // Conditions to exit loop. + * if (if escape loop event) { + * if (BLI_available_threadslots(&lb) == max_threads) { + * break; + * } + * } + * } * - * BLI_threadpool_end(&lb); + * BLI_threadpool_end(&lb); * - ************************************************ */ + * \endcode + */ static pthread_mutex_t _image_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _image_draw_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _viewer_lock = PTHREAD_MUTEX_INITIALIZER; -- cgit v1.2.3