httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h iroshan <iroshanm...@gmail.com>
Subject Re: Creating a new thread inside a module
Date Sat, 04 Jul 2009 19:13:54 GMT
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.

Mime
View raw message