Re: variadic arguments not thread safe on amd64?

2009-04-27 Thread Matt Provost
On Mon, Apr 27, 2009 at 08:49:27PM -0700, Andrew Pinski wrote: > On Mon, Apr 27, 2009 at 8:37 PM, Matt Provost wrote: > > void tdebug(const char *format, ...) { > > ?? ??va_list ap; > > ?? ??pthread_mutex_lock(&m); > > ?? ??mylog.format = format; > > ?? ??v

variadic arguments not thread safe on amd64?

2009-04-27 Thread Matt Provost
I've been trying to write a program with a logging thread that will consume messages in 'printf format' passed via a struct. It seemed that this should be possible using va_copy to copy the variadic arguments but they would always come out as garbage. This is with gcc 4.1.2 on amd64. Reading throug