Re: need help w/ clone(2)

Marnix Coppens (maco@telindus.be)
Fri, 12 Mar 1999 14:16:52 +0100


Some student wrote:
>main()
>{
> struct timespec val = {0, 300000000};
> [some code to start a thread calling test()]
>}
>
>int test()
>{
> while (1) {
> nanosleep(&val, NULL);
> printf("child thread\n");
> }
> return 0;
>}

How's your thread function supposed to access <val>? This shouldn't even
compile. Make <val> either local to test() or global to the program.

BTW, calling nanosleep like this won't do either.

Marnix Coppens

--
When she told me I was average, she was just being mean.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/