Skip navigation.
Home
The QNX Community Portal

View topic - daemon resource manager

daemon resource manager

For discussion of realtime and/or embedded programming.

daemon resource manager

Postby rahil » Fri Aug 28, 2009 6:04 am

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.
rahil
Active Member
 
Posts: 75
Joined: Wed Feb 11, 2009 12:13 pm
Location: India

RE: daemon resource manager

Postby maschoen » Fri Aug 28, 2009 9:59 am

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?
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: RE: daemon resource manager

Postby rahil » Fri Aug 28, 2009 10:38 am

maschoen wrote: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.

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.

maschoen wrote: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?

its the same definition.......and I want to know how to implement such a multi-threaded resource manager...
rahil
Active Member
 
Posts: 75
Joined: Wed Feb 11, 2009 12:13 pm
Location: India

RE: Re: RE: daemon resource manager

Postby mario » Fri Aug 28, 2009 1:00 pm

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.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: RE: daemon resource manager

Postby maschoen » Fri Aug 28, 2009 3:34 pm

rahil wrote: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.


http://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".

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


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

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

# my_process &


2) 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.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 3 guests