F
Felix Kater
The function f gets variable arguments and creates several threads
which each shall receive all of the variable arguments. Like so:
void f(
my_callback* array_of_callbacks,
...){
va_list va;
va_start(va,array_of_callbacks);
/* now loop through array */
/* create thread for each callback
and pass va for each callback
*/
/* end of loop */
va_end va;
}
(1) Is it ok to use the locally created va and return from f() even
though the threads may still run and access va?
(2) Is it ok to va_start va *only once* for all callbacks/threads in the
loop or do I have to provide copies like va1, va2, va3 for each
iteration? This would make thinks complicated since the count is
variable: I would have to dynamically create an array of va -- who
would finalize them, however?
Felix
which each shall receive all of the variable arguments. Like so:
void f(
my_callback* array_of_callbacks,
...){
va_list va;
va_start(va,array_of_callbacks);
/* now loop through array */
/* create thread for each callback
and pass va for each callback
*/
/* end of loop */
va_end va;
}
(1) Is it ok to use the locally created va and return from f() even
though the threads may still run and access va?
(2) Is it ok to va_start va *only once* for all callbacks/threads in the
loop or do I have to provide copies like va1, va2, va3 for each
iteration? This would make thinks complicated since the count is
variable: I would have to dynamically create an array of va -- who
would finalize them, however?
Felix