diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-07 08:57:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-07 09:19:42 +0300 |
commit | 267b8e1a5c322c87d9684638cc29c984c6d33e58 (patch) | |
tree | 3c64784ae8ef56c801679f906d427ee7451406ea /source/blender/blenlib/intern | |
parent | 379d5d7349400d09e1c266665398e97dcb7a9993 (diff) |
Cleanup: spelling
Also correct wrapped lines of example code in threads.cc.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/mesh_boolean.cc | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/threads.cc | 63 |
3 files changed, 37 insertions, 30 deletions
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 5e88f8f3e44..acb18d0e53e 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -224,7 +224,7 @@ void BLI_listbase_swaplinks(ListBase *listbase, void *vlinka, void *vlinkb) /** * Swaps \a vlinka and \a vlinkb from their respective lists. - * Assumes they are both already in their lista! + * Assumes they are both already in their \a listbasea! */ void BLI_listbases_swaplinks(ListBase *listbasea, ListBase *listbaseb, void *vlinka, void *vlinkb) { diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index 563742b9274..3b128aba102 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -2425,7 +2425,7 @@ static IMesh gwn_boolean(const IMesh &tm, int other_shape = 1 - shape; /* The point_is_inside_shape function has to approximate if the other * shape is not PWN. For most operations, even a hint of being inside - * givs good results, but when shape is the cutter in a Difference + * gives good results, but when shape is the cutter in a Difference * operation, we want to be pretty sure that the point is inside other_shape. * E.g., T75827. */ 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; |