apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Santosh Pathak" <spat...@veritas.com>
Subject Problem with Threads
Date Wed, 14 May 2003 08:45:00 GMT
Hi,

I am using APR library in my application.
Surprisingly arguments passed to a thread is not working.
When I went through the source code, I saw following piece of code for
thread creation.

apr_thread_create()
{
    (*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));

    (*new)->pool = pool;
    (*new)->data = data;
    (*new)->func = func;

	if (((*new)->td = (HANDLE)_beginthreadex(NULL, 0,
                        (unsigned int (APR_THREAD_FUNC
*)(void*))dummy_worker,
                        (*new), 0, &temp)) == 0) {

}


So this way, argument passed to _beginthreadex is "new" and NOT "data".
(which is passed argument to the thread)
Is this correct?


Even sample source code (TstAprRoutines) available on the site is not
working!!!
in the file aprthreads.cpp, in the function ExThreadFunc1(),
value of initialcount is garbled, when you run the program :)

I want to pass class reference to different threads, and what I am seeing in
the thread function, I am getting new thread handle as argument :(
Could you please explain me how to pass an argument to a thread with the
function apr_thread_create()?

Thanks in advance

- Santosh Pathak
  VERITAS Enterprise Administrator
  VERITAS Software


Mime
View raw message