>Number: 949
>Category: os-windows
>Synopsis: acces to thread **child_handles wanted.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache (Apache HTTP Project)
>State: open
>Class: change-request
>Submitter-Id: apache
>Arrival-Date: Thu Jul 31 04:20:00 1997
>Originator: [EMAIL PROTECTED]
>Organization:
apache
>Release: 1.3a1
>Environment:
OS=WindowsNT4
Apache=1.3a1
Compiler=MSVC++5.0
>Description:
In a module, if you want to use friendly threads,
and you want config data by thread using array, you can write functions as:
/* public function returning the number of threads in the process */
int threads_number() {
extern int threads_per_child;
return threads_per_child;
}
/* public function returning an offset [0 to ThreadsPerChild-1] or -1 on error
*/
int thread_offset () {
int i;
extern HANDLE* child_handles;
HANDLE thread_handle = GetCurrentThread();
for ( i=threads_number()-1 ; i>=0 ; i-- )
if( thread_handle == child_handles[i] )
return i;
return -1;
}
but the problem is:
child_handles is in the worker_main function stack.
Merci.
>How-To-Repeat:
>Fix:
Don't put child_handles in the worker_main function stack.
%0
>Audit-Trail:
>Unformatted: