lkml.org 
[lkml]   [2021]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH v2 04/10] perf workqueue: add threadpool execute and wait functions
On Fri, Jul 30, 2021 at 8:34 AM Riccardo Mancini <rickyman7@gmail.com> wrote:
>
> This patch adds:
> - threadpool__execute: assigns a task to the threads to execute
> asynchronously.
> - threadpool__wait: waits for the task to complete on all threads.
> Furthermore, testing for these new functions is added.
>
> This patch completes the threadpool.
>
> Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
> ---

[SNIP]
> +/**
> + * threadpool__wake_thread - send wake msg to @thread
> + *
> + * This function does not wait for the thread to actually wake
> + * NB: call only from main thread!
> + */
> +static int threadpool__wake_thread(struct threadpool_entry *thread)

Same here. You can pass pool and idx instead.

Thanks,
Namhyung


> +{
> + int res;
> + enum threadpool_msg msg = THREADPOOL_MSG__WAKE;
> +
> + res = writen(thread->pipes.cmd[1], &msg, sizeof(msg));
> + if (res < 0) {
> + pr_debug2("threadpool: error sending wake msg: %s\n", strerror(errno));
> + return -THREADPOOL_ERROR__WRITEPIPE;
> + }
> +
> + pr_debug2("threadpool: sent wake msg %s to tid=%d\n",
> + threadpool_msg_tags[msg], thread->tid);
> + return 0;
> +}
> +

\
 
 \ /
  Last update: 2021-08-07 04:56    [W:0.054 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site