Search code examples
cpthreadsposix

Maintain pthread after executing


Is it possible to have a POSIX thread remain "alive" after executing the function given as an argument? As in reusing that thread for further work.

For example, given a queue of functions to execute, is it possible to have a pthread execute several of them? The alternative would be creating a pthread for every task.


Solution

  • No.

    What you describe reminds me of a thread pool, where a set of threads is waiting for work (your functions in this case) to execute.