
iroshanmail at gmail
Jul 4, 2009, 12:13 PM
Post #17 of 17
(696 views)
Permalink
|
|
Re: Creating a new thread inside a module
[In reply to]
|
|
Hi All, I am still unable to create a new thread inside the balancer_init function. Here the way that I tried. But in this way new thread was created and it terminate after the balancer_init function finish its context. I want run this new thread for ever until the server stop. Please help me to solve this problem... static int balancer_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { apr_status_t rv; apr_thread_t *tp; apr_threadattr_t *thd_attr; rv =apr_thread_create(&tp, thd_attr, doit, ptemp, p); apr_thread_detach(tp); //do some thing here // // return 0; } here is the function passes for creation new thread static void* APR_THREAD_FUNC doit(apr_thread_t *thread, void *data) { while(1){ printf("ok"); //do some thing here } } Iroshan.
|