daemon resource manager

HI. I’ve a multi-threaded resource manager which starts the thread pool by giving thread_pool_start(tpp) API. This causes the resource manager to block/never return. Now, I want my resource manager to be a daemon process. Any idea on how can I do that.

Your question is not very clear to me. I believe that when you call thread_pool_start() you have a choice of whether to have your starting thread become just another thread in the pool or for it to return. This is beside the point. To me a “daemon” is just a background process, no longer attached to a console. Your process can be started in the background regardless of how you handle the the initial thread. What is your definition of a daemon process?

yeah I can exercise this choice you mention, but at the time of calling thread_pool_create(), but not at the time of thread_pool_start(). This call never returns as suggested by the library reference.

its the same definition…and I want to know how to implement such a multi-threaded resource manager…

For the daemon check daemon().

As for multi-thread resourcemanager with the thread_pool* functions you are on the right track. It’s all well documented.

betas.qnx.com/developers/docs/6. … start.html

Description:
The thread_pool_start() function starts the thread pool pool. The function may or may not return, depending on the flags that you passed to thread_pool_create().

Please focus on the word “may”.

There are two ways that I know to end up with a daemon.

  1. Start the process in the background, eg.:

my_process &

  1. Put in code (pseudo code follows)

if (I was not started with an &)
{
fork()
If I am the parent, exit
If I am the child, close stdin, stdout, and stderr.
}

You should do this before calling the thread_pool routines.