Messages in this thread | | | Subject | Re: [patch] threading fix, tid-2.5.47-A3 | From | Luca Barbieri <> | Date | 18 Nov 2002 09:07:11 +0100 |
| |
> - 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] | |