This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: [RFC] Posix compliant behavior ofCLOCK_PROCESS/THREAD_CPUTIME_ID


On Mon, 2004-09-27 at 22:58, Christoph Lameter wrote:
> Attached follows a patch to implement the POSIX clocks according to the
> POSIX standard which states in V3 of the Single Unix Specification:
[snip]
> +	struct task *t;
> +
> +	/* Add up the cpu time for all the threads of this process */
> +	for (t = current; t != current; t = next_thread(p)) {

This is a NOOP. 

The usual idiom to process all threads of 'current''s thread group is

	t = current;
	do {
		something();
		t = next_thread(t);
	} while (t != current);

The related idiom

	for (t = next_thread(current); t != current; t = next_thread(t))
	{...}

processes all threads in the thread group other than 'current' itself.

-Enrique



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