On Thu, 7 Feb 2002, John Baldwin wrote:
> This code is not safe on SMP non-i386 machines (i.e. ia64, sparc64, alpha, and
> possibly p3 and later i386's) because the p_ucred value you read could easily
> be a stale value, thus rendering the test invalid. You need the lock for the
> compare. Conceptually minimizing the crfree's isn't bad I guess. However, the
> td_ucred pointer should nto be read if the thread is not in the kernel, and
> having it set to NULL when we leave the kernel provides a conveninet way of
> ensuring this doesn't happen since we will panic if we do.
if the ucred is stale or not is completely unimportant.
if you wish to ensure that all your threads get the new ID that you are
setting then you need to synchronise them at the program level
to ensure teh order in which they enter the kernel on their next system
calls. There is no point is sychronising with locks because
the threads in question may have run in any order anyhow.
> John Baldwin <[EMAIL PROTECTED]> <>< http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message