0
votes

What are the flags for the linux function clone to obtain the same behaviour as pthread_create? I have tried several solutions but all gives me differents pid and not only one like with pthread_create. I have tried CLONE_SIGHAND|CLONE_FS|CLONE_VM|CLONE_FILES | SIGCHLD but when I run the task manager I see different tasks for every thread and not only one task like with pthread_create. I think that pthread_create use clone to create threads.

1

1 Answers

0
votes

The CLONE_THREAD flag causes the new thread to be in the same thread group, which means that getpid(2) will return the same value as in the caller.