lkml.org 
[lkml]   [2002]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch] threading fix, tid-2.5.47-A3
From
Date
>  - please don't introduce a new pointer, just use the old one. There 
> appears to be no cases where you want to have different pointers
> anyway.
There are: suppose that you want to implement the int cfork(int* pid)
function, which returns the pid in *pid in the parent vm, in a
multithreaded application.

The child tid pointer must be set to the current thread tid field,
because the thread structure is going to be reused.

However, that field contains the tid of the forking thread in the parent
process and must not be modified. So a different pointer is needed.

You could avoid the additional pointer by letting
child_tidptr = (!(flags & CLONE_VM) && current->user_tid) ?
current->user_tid : parent_tidptr;

but this forces the thread library to reuse the thread structure when
forking.

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.159 / U:0.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site