This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: variadic arguments not thread safe on amd64?


Matt Provost <mprovost@termcap.net> writes:

> Is there a portable way to pass a va_list between threads?

This question would be more appropriate for the gcc-help@gcc.gnu.org
mailing list.

The answer is no: you can not pass va_list values between threads.  If
you think about it you will realize that the va_list value can not hold
the complete set of variable arguments, as there is no way to know how
many there are.  Therefore, if you pass enough variable arguments to a
function, it is guaranteed that some will be on the stack.  You can not
reliably pass a reference to the stack of one thread to another thread,
because the first thread might exit before the second thread runs.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]