On Mon, Apr 27, 2009 at 08:49:27PM -0700, Andrew Pinski wrote:
> On Mon, Apr 27, 2009 at 8:37 PM, Matt Provost <mprov...@termcap.net> wrote:
> > void tdebug(const char *format, ...) {
> > ?? ??va_list ap;
> > ?? ??pthread_mutex_lock(&m);
> > ?? ??mylog.format = format;
> > ?? ??va_start(ap, format);
> > ?? ??va_copy(mylog.ap, ap);
> > ?? ??pthread_cond_signal(&c);
> > ?? ??pthread_mutex_unlock(&m);
> 
> You are missing two va_end's here
> 

Yes I had a question about va_end in this situation. Putting one that
clears 'ap' seems fine but doesn't change anything. But if you va_end
the copy that you put in the struct, then what happens when the other
thread goes to use it? Or should the va_end for that be in the tprintlog
function after it's done with it?

In any case none of those combinations seem to affect the output.

Thanks,
Matt

Reply via email to