Wait for clones

Hi,
I have a methode creating several clones with the following flags: CLONE_VM | CLONE_THREAD | CLONE_SIGHAND

How to tell the parent process to wait for the clones' completion?

pid = clone( ...)

waitpid(pid, NULL , 0) always returns me -1
waitpid(-1, NULL, 0) does the same.

clone() returns a threadid, not a pid.
clone() also shares a lot common resources, if you have 2.6.34 kernel, CLONE_NEWPID
will result in a new process address space, but the return value is still thread id.

clone was invented to do threading. Use fork() if you want to create a real child process.
If you want threads use the the pthread library - pthread_create() and dozens of associated calls. Do not use clone() like that.